diff --git a/Cargo.lock b/Cargo.lock index 1ff2f31..3131af1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,7 +677,7 @@ dependencies = [ [[package]] name = "ngx-rustscript" -version = "0.1.0" +version = "0.2.0" dependencies = [ "base64", "cc", diff --git a/Cargo.toml b/Cargo.toml index 42f93ec..7aae832 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/README.md b/README.md index b55a459..9cc430f 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/docs/api/metadata.md b/docs/api/metadata.md index 3ebba06..802b461 100644 --- a/docs/api/metadata.md +++ b/docs/api/metadata.md @@ -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` | adapted | `PHASE_WORKER_PIDS` | See cross-cutting item 10. No `init` / `init_worker`. | `tests/ngx_meta.rs` (`worker_pids_*`), `tests/access_nginx.rs` | diff --git a/src/host/meta.rs b/src/host/meta.rs index 6817be3..43c58f7 100644 --- a/src/host/meta.rs +++ b/src/host/meta.rs @@ -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 { Ok(value.into_host_call_outcome()) diff --git a/tests/ngx_meta.rs b/tests/ngx_meta.rs index fe733b1..9daae0a 100644 --- a/tests/ngx_meta.rs +++ b/tests/ngx_meta.rs @@ -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!( diff --git a/tests/test_release_packaging.py b/tests/test_release_packaging.py index 74c166c..3f72148 100644 --- a/tests/test_release_packaging.py +++ b/tests/test_release_packaging.py @@ -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"] @@ -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", @@ -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} @@ -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} @@ -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(