From 20d83d180ec7fa8266406200064bbe7b5f25696f Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Thu, 9 Jan 2025 18:14:45 -0500 Subject: [PATCH] migrate ci to `dtolnaty/rust-toolchain` see: https://www.reddit.com/r/rust/comments/z1mlls/actionsrs_github_actions_need_more_maintainers_or/ --- .github/workflows/ci.yaml | 54 +++++-------------- .github/workflows/release-packaging.yaml.todo | 12 +---- .github/workflows/test.yml.todo | 27 ++++------ 3 files changed, 24 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 66c4638..af1219d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,7 @@ on: - main paths: - "**/*.rs" - - Cargo.toml + - "**/Cargo.toml" - Cargo.lock name: ci·rs @@ -21,14 +21,8 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: check + - uses: dtolnay/rust-toolchain@stable + - run: cargo check env: RUSTFLAGS: "-D warnings" @@ -36,16 +30,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + components: rustfmt + - run: cargo fmt --all -- --check clippy: strategy: @@ -54,15 +42,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: components: clippy - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-features + - run: cargo clippy --all-features env: RUSTFLAGS: "-D warnings" @@ -73,14 +56,8 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features + - uses: dtolnay/rust-toolchain@stable + - run: cargo test --all-features env: RUSTFLAGS: "-D warnings" @@ -92,12 +69,5 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: run - args: --all-features -- git --version + - uses: dtolnay/rust-toolchain@stable + - run: cargo run --all-features -- git --version diff --git a/.github/workflows/release-packaging.yaml.todo b/.github/workflows/release-packaging.yaml.todo index 52deeac..2e33d10 100644 --- a/.github/workflows/release-packaging.yaml.todo +++ b/.github/workflows/release-packaging.yaml.todo @@ -16,11 +16,7 @@ # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 -# - uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: nightly -# override: true +# - uses: dtolnay/rust-toolchain@stable # - name: Release Build # run: cargo build --release # - name: "Upload Artifact" @@ -34,11 +30,7 @@ # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 -# - uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: nightly -# override: true +# - uses: dtolnay/rust-toolchain@stable # - uses: katyo/publish-crates@v2 # with: # registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/test.yml.todo b/.github/workflows/test.yml.todo index 440f8a5..63941d1 100644 --- a/.github/workflows/test.yml.todo +++ b/.github/workflows/test.yml.todo @@ -20,7 +20,7 @@ # env: # PROJECT_NAME_UNDERSCORE: semverator # CARGO_INCREMENTAL: 0 -# RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -D warnings +# RUSTFLAGS: -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -D warnings # RUSTDOCFLAGS: -Cpanic=abort # strategy: # matrix: @@ -28,15 +28,12 @@ # runs-on: ${{ matrix.os }} # steps: # - uses: actions/checkout@v4 -# - uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: nightly -# override: true +# - uses: dtolnay/rust-toolchain@stable + id: toolchain # - name: Cache dependencies # uses: actions/cache@v4 # env: -# cache-name: cache-dependencies +# cache-name: ${{ steps.toolchain.outputs.cachekey }} # with: # path: | # ~/.cargo/.crates.toml @@ -54,14 +51,10 @@ # runs-on: ${{ matrix.os }} # steps: # - uses: actions/checkout@v4 -# - uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: nightly -# override: true +# - uses: dtolnay/rust-toolchain@stable +# - run: cargo install cargo-tarpaulin # - name: Generate test result and coverage report -# run: | -# cargo install cargo-tarpaulin -# cargo tarpaulin --engine ptrace -o lcov --output-dir coverage --coveralls $COVERALLS_TOKEN -# env: -# COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} +# run: cargo tarpaulin --engine ptrace -o lcov --output-dir coverage +# - uses: coverallsapp/github-action@v2 +# with: +# path-to-lcov: coverage/lcov.info