ci: speed up pipeline with cargo caching and merged jobs
Merge separate lint and test jobs into a single check job so clippy's compilation artifacts are reused by tests. Add actions/cache for the Cargo target directory and registry to enable incremental builds across runs. Drop unnecessary fetch-depth: 0 from CI jobs.
This commit is contained in:
parent
0e3847ade9
commit
02235426c4
2 changed files with 51 additions and 58 deletions
45
.github/workflows/deploy.yml
vendored
45
.github/workflows/deploy.yml
vendored
|
|
@ -8,14 +8,12 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
check:
|
||||||
name: Lint
|
name: Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the Go module directory
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
@ -26,40 +24,33 @@ jobs:
|
||||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
||||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Cache Cargo artifacts
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-check
|
||||||
|
restore-keys: |
|
||||||
|
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
|
||||||
|
cargo-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: nix develop -c cargo fmt --check
|
run: nix develop -c cargo fmt --check
|
||||||
|
|
||||||
- name: Clippy
|
- name: Clippy
|
||||||
run: nix develop -c cargo clippy
|
run: nix develop -c cargo clippy
|
||||||
|
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out code into the Go module directory
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Setup Nix cache
|
|
||||||
uses: nix-community/cache-nix-action@main
|
|
||||||
with:
|
|
||||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
|
||||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: nix develop -c cargo test -- --show-output
|
||||||
nix develop --command cargo test -- --show-output
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy
|
name: Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- lint
|
- check
|
||||||
- test
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
|
||||||
64
.github/workflows/push.yml
vendored
64
.github/workflows/push.yml
vendored
|
|
@ -8,14 +8,12 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
check:
|
||||||
name: Lint
|
name: Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the Go module directory
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
@ -26,42 +24,34 @@ jobs:
|
||||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
||||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Cache Cargo artifacts
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-check
|
||||||
|
restore-keys: |
|
||||||
|
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
|
||||||
|
cargo-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: nix develop -c cargo fmt --check
|
run: nix develop -c cargo fmt --check
|
||||||
|
|
||||||
- name: Run clippy
|
- name: Clippy
|
||||||
run: nix develop -c cargo clippy
|
run: nix develop -c cargo clippy
|
||||||
|
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out code into the Go module directory
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Setup Nix cache
|
|
||||||
uses: nix-community/cache-nix-action@main
|
|
||||||
with:
|
|
||||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
|
||||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: nix develop -c cargo test -- --show-output
|
||||||
nix develop --command cargo test -- --show-output
|
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
name: E2E Tests
|
name: E2E Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
@ -72,6 +62,18 @@ jobs:
|
||||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
||||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Cache Cargo artifacts
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-e2e
|
||||||
|
restore-keys: |
|
||||||
|
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
|
||||||
|
cargo-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Run E2E tests
|
- name: Run E2E tests
|
||||||
run: |
|
run: nix develop -c cargo test --features e2e --test e2e -- --show-output
|
||||||
nix develop -c cargo test --features e2e --test e2e -- --show-output
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue