Skip to content

Commit c0724e1

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 9ee36a3 commit c0724e1

1 file changed

Lines changed: 71 additions & 42 deletions

File tree

.github/workflows/ci.yml

Lines changed: 71 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,99 @@
1-
# CI workflow for zentinel-agent-sdk
2-
# All jobs are disabled (if: false) to conserve GHA minutes.
3-
# To enable: change `if: false` to `if: true` and uncomment triggers.
4-
51
name: CI
62

73
on:
8-
workflow_dispatch:
9-
# Uncomment to enable on push/PR:
10-
# push:
11-
# branches: [main]
12-
# pull_request:
13-
# branches: [main]
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: true
1411

1512
env:
1613
CARGO_TERM_COLOR: always
14+
RUST_BACKTRACE: 1
1715

1816
jobs:
19-
check:
20-
name: Check
21-
runs-on: ubuntu-latest
22-
if: false # Disabled - change to true to enable
23-
steps:
24-
- uses: actions/checkout@v4
25-
- uses: dtolnay/rust-toolchain@stable
26-
- uses: Swatinem/rust-cache@v2
27-
- run: cargo check --all-features
28-
29-
test:
30-
name: Test
31-
runs-on: ubuntu-latest
32-
if: false # Disabled - change to true to enable
33-
steps:
34-
- uses: actions/checkout@v4
35-
- uses: dtolnay/rust-toolchain@stable
36-
- uses: Swatinem/rust-cache@v2
37-
- run: cargo test --all-features
38-
3917
fmt:
40-
name: Format
18+
name: Formatting
4119
runs-on: ubuntu-latest
42-
if: false # Disabled - change to true to enable
4320
steps:
44-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
4522
- uses: dtolnay/rust-toolchain@stable
4623
with:
4724
components: rustfmt
48-
- run: cargo fmt --all -- --check
25+
- run: cargo fmt --all --check
4926

5027
clippy:
5128
name: Clippy
5229
runs-on: ubuntu-latest
53-
if: false # Disabled - change to true to enable
5430
steps:
55-
- uses: actions/checkout@v4
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
5636
- uses: dtolnay/rust-toolchain@stable
5737
with:
5838
components: clippy
59-
- uses: Swatinem/rust-cache@v2
60-
- run: cargo clippy --all-features -- -D warnings
39+
- uses: actions/cache@v5
40+
with:
41+
path: |
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
52+
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
6176

6277
examples:
63-
name: Check Examples
78+
name: Examples
6479
runs-on: ubuntu-latest
65-
if: false # Disabled - change to true to enable
6680
steps:
67-
- uses: actions/checkout@v4
81+
- name: Free disk space
82+
run: |
83+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
84+
sudo docker image prune --all --force
85+
- uses: actions/checkout@v6
6886
- uses: dtolnay/rust-toolchain@stable
69-
- uses: Swatinem/rust-cache@v2
87+
- uses: actions/cache@v5
88+
with:
89+
path: |
90+
~/.cargo/registry
91+
~/.cargo/git
92+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
93+
restore-keys: ${{ runner.os }}-cargo-registry-
94+
- uses: actions/cache@v5
95+
with:
96+
path: target
97+
key: ${{ runner.os }}-cargo-examples-${{ hashFiles('**/Cargo.lock') }}
98+
restore-keys: ${{ runner.os }}-cargo-examples-
7099
- run: cargo check --examples

0 commit comments

Comments
 (0)