From 0af937153ec02d90fd1a01e9482c323252ae3d01 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Sat, 15 Jul 2023 03:16:56 +0800 Subject: [PATCH 1/2] Improve CI --- .github/workflows/checks.yml | 29 +++++++++++++---------------- Cargo.toml | 4 ++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0043abc..7119d83 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,10 +8,11 @@ on: - main env: - CARGO_INCREMENTAL: 1 + CACHE_VERSION: 0 + + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse CARGO_TERM_COLOR: always - GITHUB_CACHE_VERSION: 1 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RUST_BACKTRACE: full @@ -22,31 +23,27 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - action: [clippy, fmt, test] + action: [clippy, fmt, nextest] steps: + - name: Setup build environment + run: rustup toolchain install nightly --profile minimal - name: Fetch latest code uses: actions/checkout@v3 - - name: Cache cargo - uses: actions/cache@v3 + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}- - - name: Cargo ${{ matrix.action }} + prefix-key: ${{ env.CACHE_VERSION }} + - name: Cargo clippy if: matrix.action == 'clippy' uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} args: --workspace --all-features --all-targets --locked - - name: Cargo ${{ matrix.action }} + - name: Cargo fmt if: matrix.action == 'fmt' - run: cargo ${{ matrix.action }} --all -- --check - - name: Cargo ${{ matrix.action }} + run: cargo fmt --all -- --check + - name: Cargo test if: matrix.action == 'test' - run: cargo ${{ matrix.action }} run --release --workspace --all-features --all-targets --locked + run: cargo test --profile ci-dev --workspace --all-features --all-targets --locked - name: Fast fail uses: vishnudxb/cancel-workflow@v1.2 if: failure() diff --git a/Cargo.toml b/Cargo.toml index 0d09052..0252ff6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,10 @@ readme = "README.md" repository = "https://github.com/hack-ink/array-bytes" version = "6.1.0" +[profile.ci-dev] +incremental = false +inherits = "dev" + [dependencies] serde = { version = "1.0", optional = true, default-features = false } From 7afdf6ff8b1726bc8524f1a3830e0109fe964c76 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Sat, 15 Jul 2023 03:21:59 +0800 Subject: [PATCH 2/2] Use test --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7119d83..cf9ff10 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - action: [clippy, fmt, nextest] + action: [clippy, fmt, test] steps: - name: Setup build environment run: rustup toolchain install nightly --profile minimal