From 6b2028fa4645fe4e756e25330631d1a99ddcde66 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Thu, 14 Nov 2024 09:14:48 -0800 Subject: [PATCH 1/5] chore: set edition for rustfmt `cargo fmt` already passes this option, but some editors prefer to call rustfmt directly. --- rustfmt.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/rustfmt.toml b/rustfmt.toml index fffa2539..7a60a958 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,3 @@ # group_imports = "StdExternalCrate" # unstable +edition = "2021" max_width = 120 \ No newline at end of file From 030a983d50e9fd5bc56455eb71ed13b08ef9219c Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Wed, 13 Nov 2024 16:39:36 -0800 Subject: [PATCH 2/5] fix(sys): remove library type declaration nginx-sys cannot be used as rlib or as a static library. --- nginx-sys/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/nginx-sys/Cargo.toml b/nginx-sys/Cargo.toml index d6840e29..afae58e1 100644 --- a/nginx-sys/Cargo.toml +++ b/nginx-sys/Cargo.toml @@ -10,9 +10,6 @@ license = "Apache-2.0" keywords = ["nginx", "ffi", "sys"] build = "build/main.rs" -[lib] -crate-type = ["staticlib", "rlib"] - [dependencies] [build-dependencies] From baf7b3ad0d832c2f883eba80d46dfb9d906c24c6 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Thu, 14 Nov 2024 20:15:18 -0800 Subject: [PATCH 3/5] chore: inherit package metadata from workspace --- Cargo.toml | 16 ++++++++++------ examples/Cargo.toml | 6 ++++-- nginx-sys/Cargo.toml | 8 ++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f3a9a2bf..8ae679a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,19 +4,23 @@ members = [ "examples", ] +[workspace.package] +edition = "2021" +license = "Apache-2.0" +homepage = "https://github.com/nginxinc/ngx-rust" +repository = "https://github.com/nginxinc/ngx-rust" + [package] name = "ngx" version = "0.5.0" -edition = "2021" autoexamples = false categories = ["api-bindings", "network-programming"] description = "FFI bindings to NGINX" -repository = "https://github.com/nginxinc/ngx-rust" -homepage = "https://github.com/nginxinc/ngx-rust" -license = "Apache-2.0" keywords = ["nginx", "module", "sys"] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] nginx-sys = { path = "nginx-sys", version = "0.5.0"} diff --git a/examples/Cargo.toml b/examples/Cargo.toml index cd27ce02..41b10971 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -2,8 +2,10 @@ name = "examples" version = "0.0.0" publish = false -edition = "2021" -license = "Apache-2.0" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dev-dependencies] ngx = { path = "../", default-features = false } diff --git a/nginx-sys/Cargo.toml b/nginx-sys/Cargo.toml index afae58e1..680d2a80 100644 --- a/nginx-sys/Cargo.toml +++ b/nginx-sys/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "nginx-sys" version = "0.5.0" -edition = "2021" categories = ["external-ffi-bindings"] description = "FFI bindings to NGINX" -repository = "https://github.com/nginxinc/ngx-rust" -homepage = "https://github.com/nginxinc/ngx-rust" -license = "Apache-2.0" keywords = ["nginx", "ffi", "sys"] build = "build/main.rs" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] From cbd1cea76c4b2a47a4eec3988d2af33adb7ce238 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Thu, 14 Nov 2024 20:20:22 -0800 Subject: [PATCH 4/5] feat!: set supported Rust version to 1.79.0 See #96 --- Cargo.toml | 2 ++ examples/Cargo.toml | 1 + nginx-sys/Cargo.toml | 1 + 3 files changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8ae679a5..c5826018 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" license = "Apache-2.0" homepage = "https://github.com/nginxinc/ngx-rust" repository = "https://github.com/nginxinc/ngx-rust" +rust-version = "1.79.0" [package] name = "ngx" @@ -21,6 +22,7 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true +rust-version.workspace = true [dependencies] nginx-sys = { path = "nginx-sys", version = "0.5.0"} diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 41b10971..24be49a6 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -6,6 +6,7 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true +rust-version.workspace = true [dev-dependencies] ngx = { path = "../", default-features = false } diff --git a/nginx-sys/Cargo.toml b/nginx-sys/Cargo.toml index 680d2a80..66e2651c 100644 --- a/nginx-sys/Cargo.toml +++ b/nginx-sys/Cargo.toml @@ -9,6 +9,7 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true +rust-version.workspace = true [dependencies] From c7829edd0d4ead85cc55f8942fa74b7dc903f414 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Thu, 14 Nov 2024 20:57:23 -0800 Subject: [PATCH 5/5] ci: check build with MSRV --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6cafe9af..05686417 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,9 +8,29 @@ env: RUSTDOCFLAGS: '-Dwarnings' jobs: + rust-version: + name: Minimal supported Rust version + outputs: + version: ${{ steps.read_version.outputs.msrv }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: read_version + run: | + awk -F '=' \ + '/^rust-version[[:space:]]*=/ { gsub(/([" ]|#.*)/,"",$2); print ("msrv=" $2) }' \ + Cargo.toml \ + | tee -a "$GITHUB_OUTPUT" + test-linux: name: Test (Linux) + needs: rust-version runs-on: ubuntu-latest + strategy: + matrix: + rust-version: + - ${{ needs.rust-version.outputs.version }} + - stable steps: - name: checkout source uses: actions/checkout@v4 @@ -24,8 +44,8 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- + key: ${{ runner.os }}-cargo-${{ matrix.rust-version}}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ matrix.rust-version }}- - name: set up nginx deps cache uses: actions/cache@v4 continue-on-error: false @@ -38,24 +58,29 @@ jobs: .cache/*.tar.sig key: ${{ runner.os }}-deps-${{ hashFiles('**/nginx-sys/build.rs') }} restore-keys: ${{ runner.os }}-deps- - - uses: dtolnay/rust-toolchain@stable + + - uses: dtolnay/rust-toolchain@master with: components: rustfmt, clippy + toolchain: ${{ matrix.rust-version }} - name: build id: build run: cargo build --workspace --all-targets --all-features - name: run clippy - if: ${{ !cancelled() && steps.build.outcome == 'success' }} # always run if build succeeds + # always run if build succeeds + if: ${{ !cancelled() && steps.build.outcome == 'success' }} run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings - name: run tests - if: ${{ !cancelled() && steps.build.outcome == 'success' }} # always run if build succeeds + # always run if build succeeds + if: ${{ !cancelled() && steps.build.outcome == 'success' }} run: cargo test --workspace --all-features - name: rustdoc - if: ${{ !cancelled() && steps.build.outcome == 'success' }} # always run if build succeeds + # always run if build succeeds + if: ${{ !cancelled() && steps.build.outcome == 'success' }} run: cargo doc --no-deps examples-linux: