Skip to content

Commit e7dc19b

Browse files
ci: enable CI workflows on push/PR
Enable CI on push to main and pull requests, matching the zentinel proxy CI pattern. Updates actions to checkout@v6, rust-toolchain@stable, cache@v5 with separate registry and build caches, free disk space steps, and concurrency control.
1 parent 002c186 commit e7dc19b

1 file changed

Lines changed: 48 additions & 71 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,95 +4,72 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
8-
workflow_dispatch:
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: true
911

1012
env:
1113
CARGO_TERM_COLOR: always
1214
RUST_BACKTRACE: 1
1315

1416
jobs:
15-
check:
16-
name: Check
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v4
20-
21-
- name: Install Rust
22-
uses: dtolnay/rust-action@stable
23-
24-
- name: Cache cargo
25-
uses: actions/cache@v4
26-
with:
27-
path: |
28-
~/.cargo/bin/
29-
~/.cargo/registry/index/
30-
~/.cargo/registry/cache/
31-
~/.cargo/git/db/
32-
target/
33-
key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.toml') }}
34-
35-
- name: Run cargo check
36-
run: cargo check --all-targets
37-
38-
test:
39-
name: Test
40-
runs-on: ubuntu-latest
41-
steps:
42-
- uses: actions/checkout@v4
43-
44-
- name: Install Rust
45-
uses: dtolnay/rust-action@stable
46-
47-
- name: Cache cargo
48-
uses: actions/cache@v4
49-
with:
50-
path: |
51-
~/.cargo/bin/
52-
~/.cargo/registry/index/
53-
~/.cargo/registry/cache/
54-
~/.cargo/git/db/
55-
target/
56-
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
57-
58-
- name: Run tests
59-
run: cargo test --all-targets
60-
6117
fmt:
62-
name: Format
18+
name: Formatting
6319
runs-on: ubuntu-latest
6420
steps:
65-
- uses: actions/checkout@v4
66-
67-
- name: Install Rust
68-
uses: dtolnay/rust-action@stable
21+
- uses: actions/checkout@v6
22+
- uses: dtolnay/rust-toolchain@stable
6923
with:
7024
components: rustfmt
71-
72-
- name: Check formatting
73-
run: cargo fmt --all -- --check
25+
- run: cargo fmt --all --check
7426

7527
clippy:
7628
name: Clippy
7729
runs-on: ubuntu-latest
7830
steps:
79-
- uses: actions/checkout@v4
80-
81-
- name: Install Rust
82-
uses: dtolnay/rust-action@stable
31+
- name: Free disk space
32+
run: |
33+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
34+
sudo docker image prune --all --force
35+
- uses: actions/checkout@v6
36+
- uses: dtolnay/rust-toolchain@stable
8337
with:
8438
components: clippy
85-
86-
- name: Cache cargo
87-
uses: actions/cache@v4
39+
- uses: actions/cache@v5
8840
with:
8941
path: |
90-
~/.cargo/bin/
91-
~/.cargo/registry/index/
92-
~/.cargo/registry/cache/
93-
~/.cargo/git/db/
94-
target/
95-
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }}
42+
~/.cargo/registry
43+
~/.cargo/git
44+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
45+
restore-keys: ${{ runner.os }}-cargo-registry-
46+
- uses: actions/cache@v5
47+
with:
48+
path: target
49+
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
50+
restore-keys: ${{ runner.os }}-cargo-clippy-
51+
- run: cargo clippy --workspace --all-targets -- -D warnings
9652

97-
- name: Run clippy
98-
run: cargo clippy --all-targets -- -D warnings
53+
test:
54+
name: Tests
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Free disk space
58+
run: |
59+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
60+
sudo docker image prune --all --force
61+
- uses: actions/checkout@v6
62+
- uses: dtolnay/rust-toolchain@stable
63+
- uses: actions/cache@v5
64+
with:
65+
path: |
66+
~/.cargo/registry
67+
~/.cargo/git
68+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
69+
restore-keys: ${{ runner.os }}-cargo-registry-
70+
- uses: actions/cache@v5
71+
with:
72+
path: target
73+
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
74+
restore-keys: ${{ runner.os }}-cargo-test-
75+
- run: cargo test --workspace

0 commit comments

Comments
 (0)