From 9fa1015132584cdcd69fafcecd7d0ce7f4eef4fb Mon Sep 17 00:00:00 2001 From: JuanLeon Lahoz Date: Sat, 31 Dec 2022 15:39:01 +0100 Subject: [PATCH] Move from actions-rs/tarpaulin to actions/cache --- .github/workflows/coverage.yml | 22 ++++++++++++--- .github/workflows/release.yml | 13 +++++++++ .github/workflows/test.yml | 49 +++++++++++++++++++++++----------- 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 05dc560..43b6fff 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,10 +13,26 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Run cargo-tarpaulin - uses: actions-rs/tarpaulin@v0.1 + + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false with: - args: '-- --test-threads 1' + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Install cargo-tarpaulin + run: cargo install cargo-tarpaulin + + - name: Run cargo-tarpaulin + run: cargo tarpaulin --out xml --ignore-tests -- --test-threads 1 + - name: Upload to codecov.io uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cfc4e4c..affa05f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,19 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: Install prerequisites shell: bash run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 598780e..c9e19e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,18 +10,37 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - # We need to avoid concurrency running tests (that are very fast, - # anyways), in order to to avoid false positives when testing if writing - # colored output in the terminal is enabled or disabled (a test could - # enable it while other is running and checking if is disabled). - run: cargo test -- --test-threads=1 - - name: Check format - run: cargo fmt -- --check - - name: Get clippy version - run: cargo clippy -V - - name: Run clippy - run: cargo clippy -- -D clippy::all + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Build + run: cargo build --verbose + + - name: Run tests + # We need to avoid concurrency running tests (that are very fast, + # anyways), in order to to avoid false positives when testing if writing + # colored output in the terminal is enabled or disabled (a test could + # enable it while other is running and checking if is disabled). + run: cargo test -- --test-threads=1 + + - name: Check format + run: cargo fmt -- --check + + - name: Get clippy version + run: cargo clippy -V + + - name: Run clippy + run: cargo clippy -- -D clippy::all