@@ -5,8 +5,6 @@ name: Rust CI
55on :
66 pull_request :
77 types : [opened, reopened, synchronize, labeled]
8- pull_request_target :
9- types : [opened, reopened, synchronize, labeled]
108 push :
119 branches :
1210 - main
3129 CARGO_DENY_VERSION : ' 0.18.3'
3230
3331jobs :
34- rust-ci :
32+ rust :
3533 name : Rust CI
36- # Run for all events, but apply different logic based on the event type
37- if : |
38- github.event_name == 'pull_request' ||
39- github.event_name == 'push' ||
40- github.event_name == 'schedule' ||
41- (github.event_name == 'pull_request_target' &&
42- github.event.pull_request.head.repo.full_name != github.repository)
4334 timeout-minutes : 20
4435 runs-on : ${{ matrix.os }}
45- # Apply environment protection only for external PRs and sensitive events
46- environment : ${{
47- (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
48- || github.event_name == 'push'
49- || github.event_name == 'schedule'
50- && 'ci-with-secrets' || '' }}
5136 defaults :
5237 run :
5338 working-directory : ./
39+ # permissions:
40+ # contents: read
41+ # actions: read
42+ # pull-requests: read
43+ env :
44+ # CC: deny_c
45+ RUST_CHANNEL : ' 1.87.0'
5446
5547 strategy :
5648 fail-fast : false
@@ -61,30 +53,15 @@ jobs:
6153 - name : Checkout repository
6254 uses : actions/checkout@v5
6355 with :
64- # For pull_request_target, checkout the PR head
65- ref : ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
56+ ref : ${{ github.event.pull_request.head.sha }}
6657
67- # Docker services - only for tests that need secrets (internal/external PRs with secrets, push, schedule)
6858 - name : Stand up docker services
69- if : |
70- (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') &&
71- (
72- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
73- github.event_name == 'push' ||
74- github.event_name == 'schedule' ||
75- (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
76- )
77- run : docker compose up -d
59+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
60+ run : |
61+ docker compose up -d
7862
7963 - name : Wait for containers to be ready
80- if : |
81- (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') &&
82- (
83- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
84- github.event_name == 'push' ||
85- github.event_name == 'schedule' ||
86- (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
87- )
64+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
8865 run : |
8966 for _ in {1..10}; do
9067 if curl --silent --fail http://minio:9000/minio/health/live; then
10077 sleep 3
10178 done
10279
103- # Common setup steps for all scenarios
10480 - name : Install Just
10581 if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
10682 run : sudo snap install --edge --classic just
@@ -114,76 +90,56 @@ jobs:
11490 - name : Cache Dependencies
11591 uses : Swatinem/rust-cache@v2
11692 with :
93+ # workspaces: "rust -> target"
11794 key : ${{ env.RUST_CHANNEL }}
11895
11996 - name : Install cargo-deny
12097 if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
12198 run : cargo install --locked cargo-deny --version ${{ env.CARGO_DENY_VERSION }}
12299
123- # Basic checks that run for all pull requests (including external)
124- - name : Check formatting
125- if : matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request'
126- run : cargo fmt --all -- --check
127-
128- - name : Clippy
129- if : matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request'
130- run : cargo clippy --all-targets --all-features -- -D warnings
131-
132- - name : Cargo deny
133- if : matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request'
134- run : cargo deny check
135-
136- # Full checks with secrets - for internal PRs, external PRs (with approval), push, and schedule
137- - name : Check (with secrets)
138- if : |
139- (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') &&
140- (
141- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
142- github.event_name == 'push' ||
143- github.event_name == 'schedule' ||
144- (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
145- )
100+ - name : Check
101+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
146102 env :
147103 R2_BUCKET : ${{ secrets.R2_BUCKET }}
148104 R2_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
149105 R2_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
150106 R2_ACCOUNT_ID : ${{ secrets.R2_ACCOUNT_ID }}
107+
151108 AWS_BUCKET : ${{ secrets.AWS_BUCKET }}
152109 AWS_REGION : ${{ secrets.AWS_REGION }}
153110 AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
154111 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
112+
155113 TIGRIS_BUCKET : ${{ secrets.TIGRIS_BUCKET }}
156114 TIGRIS_REGION : ${{ secrets.TIGRIS_REGION }}
157115 TIGRIS_ACCESS_KEY_ID : ${{ secrets.TIGRIS_ACCESS_KEY_ID }}
158116 TIGRIS_SECRET_ACCESS_KEY : ${{ secrets.TIGRIS_SECRET_ACCESS_KEY }}
159- run : just pre-commit
160117
161- # Unit tests for non-Ubuntu platforms that need secrets
118+ run : |
119+ just pre-commit
120+
162121 - name : Run unit tests only
163- if : |
164- (matrix.os != 'ubuntu-latest' && matrix.os != 'ubuntu-24.04-arm') &&
165- (
166- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
167- github.event_name == 'push' ||
168- github.event_name == 'schedule' ||
169- (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
170- )
171- run : cargo test --lib
172-
173- # Expensive integration tests - only on schedule
122+ if : matrix.os != 'ubuntu-latest' && matrix.os != 'ubuntu-24.04-arm'
123+ run : |
124+ cargo test --lib
125+
174126 - name : Run integration tests against object stores
175- if : github.event_name == 'schedule '
127+ if : github.event_name == 'cron '
176128 env :
177129 R2_BUCKET : ${{ secrets.R2_BUCKET }}
178130 R2_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
179131 R2_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
180132 R2_ACCOUNT_ID : ${{ secrets.R2_ACCOUNT_ID }}
133+
181134 AWS_BUCKET : ${{ secrets.AWS_BUCKET }}
182135 AWS_REGION : ${{ secrets.AWS_REGION }}
183136 AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
184137 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
138+
185139 TIGRIS_BUCKET : ${{ secrets.TIGRIS_BUCKET }}
186140 TIGRIS_REGION : ${{ secrets.TIGRIS_REGION }}
187141 TIGRIS_ACCESS_KEY_ID : ${{ secrets.TIGRIS_ACCESS_KEY_ID }}
188142 TIGRIS_SECRET_ACCESS_KEY : ${{ secrets.TIGRIS_SECRET_ACCESS_KEY }}
189- run : cargo test --all --all-targets -- --ignored
143+
144+ run : |
145+ cargo test --all --all-targets -- --ignored
0 commit comments