|
1 | 1 | name: CI on Linux |
2 | 2 |
|
3 | 3 | on: |
4 | | - # Trigger builds on pull requests |
5 | 4 | pull_request: |
6 | 5 | paths-ignore: |
7 | 6 | - "**.md" |
8 | | - |
9 | | - # Trigger builds AND tests on push to main |
10 | 7 | push: |
11 | 8 | branches: |
12 | 9 | - main |
13 | 10 | paths-ignore: |
14 | 11 | - "**.md" |
15 | 12 |
|
16 | | - # Add manual trigger via Actions UI for running BOTH build and test |
17 | | - workflow_dispatch: |
18 | | - |
19 | 13 | env: |
20 | 14 | RUST_LOG: info |
21 | 15 | RUST_BACKTRACE: 1 |
|
37 | 31 | - name: RockyLinux-9 / CUDA-12.8.1 / x86_64 |
38 | 32 | image: "ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest" |
39 | 33 | runner: ubuntu-latest |
40 | | - outputs: |
41 | | - # Output the result of the permission check |
42 | | - actor_has_write_permission: ${{ steps.check_access.outputs.require-result }} |
43 | | - # Output the build artifact details so the test job can use them |
44 | | - artifact_name: ${{ steps.artifact_details.outputs.name }} |
45 | | - artifact_path: ${{ steps.artifact_details.outputs.path }} |
46 | 34 |
|
47 | 35 | steps: |
48 | 36 | - name: Free up space |
@@ -86,18 +74,10 @@ jobs: |
86 | 74 | docker system prune -af || true |
87 | 75 | docker builder prune -af || true |
88 | 76 | df -h |
| 77 | +
|
89 | 78 | - name: Checkout repository |
90 | 79 | uses: actions/checkout@v4 |
91 | 80 |
|
92 | | - - name: Check access permissions |
93 | | - id: check_access |
94 | | - uses: actions-cool/check-user-permission@v2 |
95 | | - with: |
96 | | - require: write |
97 | | - username: ${{ github.triggering_actor }} |
98 | | - env: |
99 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
100 | | - |
101 | 81 | - name: Pull build image |
102 | 82 | run: docker pull ${{ matrix.variance.image }} |
103 | 83 |
|
@@ -170,88 +150,10 @@ jobs: |
170 | 150 | cargo doc --workspace --all-features --document-private-items --no-deps |
171 | 151 | ' |
172 | 152 |
|
173 | | - - name: Normalize build artifacts ownership |
174 | | - run: | |
175 | | - docker exec "$CONTAINER_NAME" bash -lc "rm -rf /workspace/target/debug/incremental || true" |
176 | | - docker exec "$CONTAINER_NAME" bash -lc "chown -R ${HOST_UID}:${HOST_GID} /workspace/target || true" |
177 | | -
|
178 | 153 | - name: Stop build container |
179 | 154 | run: | |
180 | 155 | docker rm -f "$CONTAINER_NAME" || true |
181 | | - - name: Prepare artifact details |
182 | | - id: artifact_details |
183 | | - run: | |
184 | | - SANITIZED_NAME=$(echo '${{ matrix.variance.name }}' | sed 's/[^a-zA-Z0-9.-]/-/g') |
185 | | - ARTIFACT_NAME="target_debug-${SANITIZED_NAME}-${{ github.run_id }}" |
186 | | - ARTIFACT_PATH="target/debug" |
187 | | - echo "name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT |
188 | | - echo "path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT |
189 | 156 |
|
190 | | - - name: Upload build artifacts |
191 | | - uses: actions/upload-artifact@v4 |
192 | | - with: |
193 | | - name: ${{ steps.artifact_details.outputs.name }} |
194 | | - path: ${{ steps.artifact_details.outputs.path }} |
195 | | - retention-days: 1 |
196 | | - |
197 | | - test: |
198 | | - name: Test / ${{ matrix.variance.name }} |
199 | | - # Depends on the build job |
200 | | - needs: build |
201 | | - # Run ONLY IF: |
202 | | - # - The corresponding 'build' job succeeded AND |
203 | | - # - EITHER: |
204 | | - # - Event is 'push' to 'main' |
205 | | - # - OR Event is 'workflow_dispatch' |
206 | | - # - OR Event is 'pull_request' AND the 'actor_has_write_permission' output from build is 'true' |
207 | | - if: > |
208 | | - needs.build.result == 'success' && |
209 | | - ( |
210 | | - (github.event_name == 'push' && github.ref == 'refs/heads/main') || |
211 | | - github.event_name == 'workflow_dispatch' || |
212 | | - (github.event_name == 'pull_request' && needs.build.outputs.actor_has_write_permission == 'true') |
213 | | - ) |
214 | | - runs-on: ${{ matrix.variance.runner }} |
215 | | - # Use the exact same container image as the build job |
216 | | - container: |
217 | | - image: ${{ matrix.variance.image }} |
218 | | - strategy: |
219 | | - # Save some credits |
220 | | - fail-fast: true |
221 | | - matrix: |
222 | | - variance: |
223 | | - # Must match the build job's matrix definition |
224 | | - - name: Ubuntu-24.04 / CUDA-12.8.1 / x86_64 |
225 | | - image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest" |
226 | | - runner: ubuntu-latest |
227 | | - - name: Ubuntu-24.04 / CUDA-12.8.1 / ARM64 |
228 | | - image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest" |
229 | | - runner: ubuntu-24.04-arm |
230 | | - steps: |
231 | | - - name: Compute artifact name |
232 | | - id: test_artifact |
233 | | - run: | |
234 | | - SANITIZED_NAME=$(echo '${{ matrix.variance.name }}' | sed 's/[^a-zA-Z0-9.-]/-/g') |
235 | | - ARTIFACT_NAME="target_debug-${SANITIZED_NAME}-${{ github.run_id }}" |
236 | | - ARTIFACT_PATH="target/debug" |
237 | | - echo "name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT |
238 | | - echo "path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT |
239 | | -
|
240 | | - - name: Download build artifacts |
241 | | - uses: actions/download-artifact@v4 |
242 | | - with: |
243 | | - name: ${{ steps.test_artifact.outputs.name }} |
244 | | - path: ${{ steps.test_artifact.outputs.path }} |
245 | | - |
246 | | - - name: List downloaded files |
247 | | - run: ls -lR ${{ steps.test_artifact.outputs.path }} |
248 | | - |
249 | | - - name: Run remote tests |
250 | | - env: |
251 | | - MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} |
252 | | - MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} |
253 | | - run: | |
254 | | - echo "Stubbed out" |
255 | 157 | compiletest: |
256 | 158 | name: Compile tests |
257 | 159 | runs-on: ubuntu-latest |
|
0 commit comments