From 71dc23dfae4f34f5c73542df616bea8cfde43308 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Fri, 22 Nov 2024 20:10:41 +0100 Subject: [PATCH] chore(ci): modernize configuration --- .github/workflows/ci.yml | 70 +++++++++++++--------------------------- 1 file changed, 22 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f37265e..b4e958b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,6 @@ name: CI -on: - pull_request: - push: - branches: - - main - -env: - CARGO_UNSTABLE_SPARSE_REGISTRY: true +on: [push, pull_request] jobs: fmt: @@ -15,40 +8,28 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - 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 + components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - name: Rust rustfmt + run: cargo fmt --all -- --check clippy: name: clippy / stable runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - 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 clippy + components: clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + - name: Run clippy + run: cargo clippy -- -D warnings test: name: test / ${{ matrix.name }} @@ -67,33 +48,26 @@ jobs: rust: 1.63.0 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ matrix.rust }} - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + - name: Run tests + run: cargo test coverage: name: coverage / stable runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: dtolnay/rust-toolchain@stable - name: Install cargo-tarpaulin run: | - LINK="https://github.com/xd009642/tarpaulin/releases/download/0.20.1/cargo-tarpaulin-0.20.1-travis.tar.gz" + LINK="https://github.com/xd009642/tarpaulin/releases/download/0.31.2/cargo-tarpaulin-x86_64-unknown-linux-gnu.tar.gz" curl -L --output tarpaulin.tar.gz "$LINK" tar -xzvf tarpaulin.tar.gz chmod +x cargo-tarpaulin @@ -102,12 +76,12 @@ jobs: run: ./cargo-tarpaulin tarpaulin --out Xml - name: Upload to codecov.io - uses: codecov/codecov-action@v2 - with: - token: ${{secrets.CODECOV_TOKEN}} + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Archive code coverage results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: code-coverage-report path: cobertura.xml