Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ngx-rustscript"
version = "0.1.0"
version = "0.2.0"
edition = "2024"
publish = false
rust-version = "1.85.0"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ bash tests/verify_add_dynamic.sh

### Release packages

Pushing a `v*` tag whose version matches `Cargo.toml` creates a GitHub Release.
The current package version is `0.2.0`. Pushing a `v*` tag whose version
matches `Cargo.toml` creates a GitHub Release.
The Release workflow can also be started manually with an existing `v*` tag.
Linux amd64 releases provide:

Expand Down
2 changes: 1 addition & 1 deletion docs/api/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Cycle-dependent hosts fail with a host error when `ngx_cycle` is null.
| `ngx.config.prefix` | `ngx::config::prefix() -> string` | adapted | `PHASE_CONFIG_RUNTIME` | Owned copy of `ngx_cycle.prefix`. Requires a live cycle. | `tests/ngx_meta.rs`, `tests/access_nginx.rs` |
| `ngx.config.nginx_version` | `ngx::config::nginx_version() -> int` | supported | `PHASE_CONFIG_RUNTIME` | `nginx_sys::nginx_version` (1031004 for NGINX 1.31.4). Unlike `nginx_configure`, allowed in `init_worker` and `exit_worker`. | `tests/ngx_meta.rs`, `tests/host_catalog.rs` |
| `ngx.config.nginx_configure` | `ngx::config::nginx_configure() -> string` | supported | `PHASE_CONFIG_BUILD` | `NGX_CONFIGURE` (`--with-compat`, `--with-http_ssl_module`, ...). Not allowed in `init_worker` / `exit_worker`. | `tests/ngx_meta.rs` |
| `ngx.config.ngx_lua_version` | `ngx::config::ngx_rustscript_version() -> int` | adapted | `PHASE_CONFIG_BUILD` | **Not** a forged lua-nginx-module version. Encodes crate 0.x.y as `x * 1000 + y` (0.1.0 reports `1000`). Same phases as `nginx_configure`. | `tests/ngx_meta.rs` |
| `ngx.config.ngx_lua_version` | `ngx::config::ngx_rustscript_version() -> int` | adapted | `PHASE_CONFIG_BUILD` | **Not** a forged lua-nginx-module version. Encodes crate 0.x.y as `x * 1000 + y` (0.2.0 reports `2000`). Same phases as `nginx_configure`. | `tests/ngx_meta.rs` |
| `ngx.worker.exiting` | `ngx::worker::exiting() -> bool` | supported | `PHASE_CONFIG_RUNTIME` | Live `ngx_exiting`. | `tests/ngx_meta.rs`, `tests/access_nginx.rs` |
| `ngx.worker.pid` | `ngx::worker::pid() -> int` | supported | `PHASE_CONFIG_RUNTIME` | Live `ngx_pid`. | `tests/ngx_meta.rs`, `tests/access_nginx.rs` |
| `ngx.worker.pids` | `ngx::worker::pids() -> array<int>` | adapted | `PHASE_WORKER_PIDS` | See cross-cutting item 10. No `init` / `init_worker`. | `tests/ngx_meta.rs` (`worker_pids_*`), `tests/access_nginx.rs` |
Expand Down
4 changes: 2 additions & 2 deletions src/host/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use super::super::VmResult;
use super::{CallOutcome, IntoHostCallOutcome};

/// `ngx.config.ngx_lua_version` encodes 0.x.y as `x * 1000 + y`.
/// Crate version 0.1.0 therefore reports 1000.
pub const NGX_RUSTSCRIPT_VERSION: i64 = 1_000;
/// Crate version 0.2.0 therefore reports 2000.
pub const NGX_RUSTSCRIPT_VERSION: i64 = 2_000;

fn ret(value: impl IntoHostCallOutcome) -> VmResult<CallOutcome> {
Ok(value.into_host_call_outcome())
Expand Down
2 changes: 1 addition & 1 deletion tests/ngx_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ fn compile_time_config_metadata_is_owned_and_truthful() {
);
assert_eq!(
expect_int(eval("use ngx;\nngx::config::ngx_rustscript_version();\n")),
1_000
2_000
);
let configure = expect_string(eval("use ngx;\nngx::config::nginx_configure();\n"));
assert_eq!(
Expand Down
21 changes: 14 additions & 7 deletions tests/test_release_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ def require_full_git_rev(rev: str, label: str) -> str:


class ReleasePackagingTests(unittest.TestCase):
def test_release_version_matches_crate_and_lockfile(self) -> None:
crate = tomllib.loads((ROOT / "Cargo.toml").read_text())
lock = tomllib.loads((ROOT / "Cargo.lock").read_text())
package = next(item for item in lock["package"] if item["name"] == crate["package"]["name"])
self.assertEqual(crate["package"]["version"], "0.2.0")
self.assertEqual(package["version"], crate["package"]["version"])

def test_rustscript_core_pin_is_frozen_full_sha(self) -> None:
cargo_toml = (ROOT / "Cargo.toml").read_text()
metadata = tomllib.loads(cargo_toml)["package"]["metadata"]["ngx-rustscript"]
Expand Down Expand Up @@ -247,7 +254,7 @@ def test_packaging_outputs_expected_reproducible_assets(self) -> None:
result = run(
str(PACKAGE_SCRIPT),
"--version",
"0.1.0",
"0.2.0",
"--arch",
"amd64",
"--module",
Expand All @@ -262,13 +269,13 @@ def test_packaging_outputs_expected_reproducible_assets(self) -> None:
)
self.assertEqual(result.returncode, 0, result.stdout)

module_tgz_name = "ngx-rustscript-module-0.1.0-linux-amd64.tgz"
bundle_tgz_name = "ngx-rustscript-nginx-0.1.0-nginx-1.31.4-linux-amd64.tgz"
deb_name = "nginx-module-rustscript_0.1.0_amd64.deb"
module_tgz_name = "ngx-rustscript-module-0.2.0-linux-amd64.tgz"
bundle_tgz_name = "ngx-rustscript-nginx-0.2.0-nginx-1.31.4-linux-amd64.tgz"
deb_name = "nginx-module-rustscript_0.2.0_amd64.deb"
expected = {module_tgz_name, bundle_tgz_name, deb_name, "SHA256SUMS"}
self.assertEqual({path.name for path in first.iterdir()}, expected)

module_top = "ngx-rustscript-module-0.1.0-linux-amd64"
module_top = "ngx-rustscript-module-0.2.0-linux-amd64"
with tarfile.open(first / module_tgz_name, "r:gz") as archive:
member_list = archive.getmembers()
members = {member.name: member for member in member_list}
Expand All @@ -295,7 +302,7 @@ def test_packaging_outputs_expected_reproducible_assets(self) -> None:
[],
)

bundle_top = "ngx-rustscript-nginx-0.1.0-nginx-1.31.4-linux-amd64"
bundle_top = "ngx-rustscript-nginx-0.2.0-nginx-1.31.4-linux-amd64"
with tarfile.open(first / bundle_tgz_name, "r:gz") as archive:
bundle_member_list = archive.getmembers()
bundle_members = {member.name: member for member in bundle_member_list}
Expand Down Expand Up @@ -336,7 +343,7 @@ def test_packaging_outputs_expected_reproducible_assets(self) -> None:

deb = first / deb_name
self.assertEqual(run("dpkg-deb", "-f", str(deb), "Package").stdout.strip(), "nginx-module-rustscript")
self.assertEqual(run("dpkg-deb", "-f", str(deb), "Version").stdout.strip(), "0.1.0")
self.assertEqual(run("dpkg-deb", "-f", str(deb), "Version").stdout.strip(), "0.2.0")
self.assertEqual(run("dpkg-deb", "-f", str(deb), "Architecture").stdout.strip(), "amd64")
self.assertEqual(run("dpkg-deb", "-f", str(deb), "Depends").stdout.strip(), "libc6, libgcc-s1")
self.assertEqual(
Expand Down
Loading