From ecda91981e7620436bfa4eea4b06e2b95e12edc1 Mon Sep 17 00:00:00 2001 From: wcampbell Date: Wed, 27 Dec 2023 15:56:20 -0500 Subject: [PATCH] Update CI; Test MSRV Update CI to maintained actions Update MSRV to 1.67.1 --- .github/workflows/coverage.yml | 13 +-- .github/workflows/main.yml | 129 +++++++++-------------------- .github/workflows/pull_request.yml | 8 +- CHANGELOG.md | 1 + Cargo.toml | 2 +- README.md | 1 + deku-derive/Cargo.toml | 1 + 7 files changed, 53 insertions(+), 102 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e2564bff..0a2c3f27 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -8,15 +8,18 @@ jobs: env: CARGO_TERM_COLOR: always steps: - - uses: actions/checkout@v3 - - name: Install Rust - run: rustup update stable + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master + with: + toolchain: stable - name: Install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov + uses: taiki-e/install-action@e8c64729e2a2a2c3cfa6751fa496b34ca19f390c # cargo-llvm-cov + - name: Generate code coverage run: cargo llvm-cov --workspace --codecov --output-path codecov.json + - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: files: codecov.json fail_ci_if_error: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b3c36a2..6bf79de3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,127 +3,74 @@ on: [push, pull_request] name: CI jobs: - check: - name: Build + build-test-run: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: build - args: --all + strategy: + matrix: + toolchain: + - stable - test: - name: Test Suite - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all + toolchain: ${{ matrix.toolchain }} -# TODO: Enable Miri -# test_miri: -# name: Miri Test -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: actions-rs/toolchain@v1 -# with: -# toolchain: nightly -# override: true -# components: miri -# - run: cargo miri test -# -# test_miri_big_endian: -# name: Miri Test Big Endian -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: actions-rs/toolchain@v1 -# with: -# toolchain: nightly -# override: true -# components: miri -# target: armebv7r-none-eabi -# - run: cargo miri test --target armebv7r-none-eabi - - examples: - name: Examples - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + # build + - run: cargo build --all + # test + - run: cargo test --all + # run examples - run: cargo run --example 2>&1 | grep -P ' ' | awk '{print $1}' | xargs -i cargo run --example {} - fmt: - name: Rustfmt + # Only build on MSRV, since trybuild will fail on older version + build-msrv: runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + # msrv + - 1.67.1 + steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + toolchain: ${{ matrix.toolchain }} + + # build + - run: cargo build --all - clippy: - name: Clippy + fmt-clippy-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master with: - profile: minimal toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + + - run: cargo clippy -- -D warnings + - run: cargo fmt --all -- --check ensure_no_std: name: Ensure no_std runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master with: toolchain: nightly - override: true - target: thumbv7em-none-eabihf + targets: thumbv7em-none-eabihf - run: cd ensure_no_std && cargo build --release --target thumbv7em-none-eabihf ensure_wasm: name: Ensure wasm runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master with: toolchain: nightly - override: true - uses: jetli/wasm-pack-action@v0.3.0 with: version: 'latest' diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 76f07e0f..7ed5ac8d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -5,15 +5,13 @@ jobs: name: Benchmark runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # master with: - profile: minimal toolchain: stable - override: true - - uses: boa-dev/criterion-compare-action@v3 + - uses: boa-dev/criterion-compare-action@adfd3a94634fe2041ce5613eb7df09d247555b87 # v3.2.4 with: branchName: ${{ github.base_ref }} token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 18bab2fb..3abe93f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ## Changes +[#390](https://github.com/sharksforarms/deku/pull/390) added MSRV for `1.67.1`. [#352](https://github.com/sharksforarms/deku/pull/352) added a new function `from_reader` that uses `io::Read`. `io::Read` is also now used internally, bringing massive performance and usability improvements. diff --git a/Cargo.toml b/Cargo.toml index 00289dbe..6170c72c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["deku", "bits", "serialization", "deserialization", "struct"] categories = ["encoding", "parsing", "no-std"] description = "bit level serialization/deserialization proc-macro for structs" readme = "README.md" -rust-version = "1.65.0" +rust-version = "1.67.1" [lib] bench = false diff --git a/README.md b/README.md index bceaa55a..4a215b62 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Avoid the requirement of writing redundant, error-prone parsing and writing code for binary structs or network headers ## Usage +*Compiler support: requires rustc 1.67.1+* ```toml [dependencies] diff --git a/deku-derive/Cargo.toml b/deku-derive/Cargo.toml index a773c0f2..5d475345 100644 --- a/deku-derive/Cargo.toml +++ b/deku-derive/Cargo.toml @@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/sharksforarms/deku" description = "bit level serialization/deserialization proc-macro for structs" readme = "../README.md" +rust-version = "1.67.1" [lib] proc-macro = true