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: diff --git a/Cargo.toml b/Cargo.toml index f3a9a2bf..c5826018 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,19 +4,25 @@ members = [ "examples", ] +[workspace.package] +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" 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 +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 cd27ce02..24be49a6 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -2,8 +2,11 @@ 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 +rust-version.workspace = true [dev-dependencies] ngx = { path = "../", default-features = false } diff --git a/nginx-sys/Cargo.toml b/nginx-sys/Cargo.toml index d6840e29..66e2651c 100644 --- a/nginx-sys/Cargo.toml +++ b/nginx-sys/Cargo.toml @@ -1,17 +1,15 @@ [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" - -[lib] -crate-type = ["staticlib", "rlib"] +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true [dependencies] 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