From 4bd7e34d827d386b53850b4b93a63d08e74b94c4 Mon Sep 17 00:00:00 2001 From: RedEtherbloom Date: Tue, 12 Nov 2024 03:01:11 +0100 Subject: [PATCH] refactor: Modernize CI/CD components action-rs has been disabled since last year. Additionally, Zprofile got recently deprecated. --- .github/workflows/build.yml | 6 ++-- .github/workflows/cd.yml | 60 ++++++++++++++++++++----------------- .github/workflows/ci.yml | 26 +++++++--------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48ad2fa..3f02296 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,12 +54,12 @@ jobs: MACOSX_DEPLOYMENT_TARGET: 10.7 steps: - uses: actions/checkout@master - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable target: ${{ matrix.target }} - default: true - - uses: actions-rs/cargo@v1 + override: true + - uses: clechasseur/rs-cargo@v2 with: command: build args: --release ${{matrix.features}} --target=${{ matrix.target }} diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index dc82b15..2c8eb5a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -64,12 +64,12 @@ jobs: MACOSX_DEPLOYMENT_TARGET: 10.7 steps: - uses: actions/checkout@master - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable target: ${{ matrix.target }} - default: true - - uses: actions-rs/cargo@v1 + override: true + - uses: clechasseur/rs-cargo@v2 with: command: build args: --release ${{matrix.features}} --target=${{ matrix.target }} @@ -122,7 +122,7 @@ jobs: steps: - name: Check out Git repository uses: actions/checkout@v4 - - uses: actions-rs/cargo@v1 + - uses: clechasseur/rs-cargo@v2 with: command: build args: --release @@ -150,7 +150,7 @@ jobs: steps: - name: Check out Git repository uses: actions/checkout@v4 - - uses: actions-rs/cargo@v1 + - uses: clechasseur/rs-cargo@v2 with: command: build args: --release @@ -180,7 +180,7 @@ jobs: steps: - name: Check out Git repository uses: actions/checkout@v4 - - uses: actions-rs/cargo@v1 + - uses: clechasseur/rs-cargo@v2 with: command: build args: --release @@ -198,11 +198,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install toolchain - uses: actions-rs/toolchain@v1 + uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly override: true - profile: minimal + components: llvm-tools-preview - run: sudo apt-get update - name: 'Install Taskwarrior' uses: ./.github/actions/install-taskwarrior @@ -217,36 +217,40 @@ jobs: - run: | # prepare taskwarrior, initial setup task rc.confirmation=off || echo 0 - - name: Execute tests - uses: actions-rs/cargo@v1 + - name: Clean environment for grcov + uses: clechasseur/rs-cargo@v2 + with: + command: clean + - name: Build taskwarrior-tui with coverage + uses: clechasseur/rs-cargo@v2 + with: + command: build + env: + RUSTFLAGS: "-Cinstrument-coverage" + - name: Run taskwarrior-tui tests in coverage environment + uses: clechasseur/rs-cargo@v2 with: command: test - args: --all + args: --worksoace env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests" - - # Note that `actions-rs/grcov` Action can install `grcov` too, - # but can't use faster installation methods yet. - # As a temporary experiment `actions-rs/install` Action plugged in here. - # Consider **NOT** to copy that into your workflow, - # but use `actions-rs/grcov` only - - name: Pre-installing grcov - uses: actions-rs/install@v0.1 + RUSTFLAGS: "-Cinstrument-coverage" + LLVM_PROFILE_FILE: "your_name-%p-%m.profraw" + - name: Install grcov + uses: clechasseur/rs-cargo@v2 with: - crate: grcov - use-tool-cache: true - + command: install + args: grcov - name: Gather coverage data - id: coverage - uses: actions-rs/grcov@v0.1 - + run: | + mkdir ./target/debug/coverage/ + grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/coverage/ + shell: bash - name: Coveralls upload uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} parallel: true - path-to-lcov: ${{ steps.coverage.outputs.report }} + file: ./target/debug/coverage/lcov grcov_finalize: runs-on: ubuntu-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de360a2..1293a51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - profile: minimal toolchain: stable override: true - - uses: actions-rs/cargo@v1 + - uses: clechasseur/rs-cargo@v2 with: command: check @@ -26,9 +25,8 @@ jobs: RUST_BACKTRACE: full steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - profile: minimal toolchain: stable override: true - run: sudo apt-get update @@ -45,23 +43,22 @@ jobs: - run: | # prepare taskwarrior, initial setup task rc.confirmation=off || echo 0 - - uses: actions-rs/cargo@v1 + - uses: clechasseur/rs-cargo@v2 with: command: test - args: --all -- --nocapture + args: --workspace -- --nocapture fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - profile: minimal toolchain: nightly override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 + components: rustfmt + - uses: clechasseur/rs-cargo@v2 with: command: fmt args: --all -- --check @@ -71,13 +68,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - profile: minimal toolchain: stable override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 + components: clippy + - uses: clechasseur/rs-cargo@v2 with: command: clippy args: -- -D warnings