1
1
name : CI on Linux
2
2
3
3
on :
4
+ # Trigger builds on pull requests
4
5
pull_request :
5
6
paths-ignore :
6
7
- " **.md"
8
+
9
+ # Trigger builds AND tests on push to main
7
10
push :
11
+ branches :
12
+ - main
8
13
paths-ignore :
9
14
- " **.md"
15
+
16
+ # Add manual trigger via Actions UI for running BOTH build and test
17
+ workflow_dispatch :
18
+
10
19
env :
11
20
RUST_LOG : info
12
21
RUST_BACKTRACE : 1
22
+
13
23
jobs :
14
24
build :
15
- name : ${{ matrix.variance.name }}
25
+ name : Build / ${{ matrix.variance.name }}
16
26
runs-on : ubuntu-latest
17
27
container :
18
28
image : ${{ matrix.variance.image }}
@@ -22,34 +32,124 @@ jobs:
22
32
variance :
23
33
# - name: Ubuntu-22.04/CUDA-11.8.0
24
34
# image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda11:latest"
25
- - name : Ubuntu-22.04/ CUDA-12.8.1
35
+ - name : Ubuntu-22.04 / CUDA-12.8.1
26
36
image : " ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda12:latest"
27
- - name : Ubuntu-24.04/ CUDA-12.8.1
37
+ - name : Ubuntu-24.04 / CUDA-12.8.1
28
38
image : " ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
29
- - name : RockyLinux-9/ CUDA-12.8.1
39
+ - name : RockyLinux-9 / CUDA-12.8.1
30
40
image : " ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest"
41
+ outputs :
42
+ # Output the result of the permission check
43
+ actor_has_write_permission : ${{ steps.check_access.outputs.require-result }}
44
+ # Output the build artifact details so the test job can use them
45
+ artifact_name : ${{ steps.artifact_details.outputs.name }}
46
+ artifact_path : ${{ steps.artifact_details.outputs.path }}
47
+
31
48
steps :
32
49
- name : Checkout repository
33
50
uses : actions/checkout@v4
51
+
52
+ - name : Check access permissions
53
+ id : check_access
54
+ uses : actions-cool/check-user-permission@v2
55
+ with :
56
+ require : write
57
+ username : ${{ github.triggering_actor }}
58
+ env :
59
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60
+
34
61
- name : Verify CUDA, Rust installation
35
62
run : |
36
63
nvcc --version
37
64
rustup show
38
65
- name : Load Rust cache
39
66
uses : Swatinem/rust-cache@v2
40
67
with :
41
- key : ${{ matrix.variance.name }}
68
+ key : ${{ matrix.variance.name }}-${{ github.sha }}
69
+
42
70
- name : Rustfmt
43
71
run : cargo fmt --all -- --check
72
+
44
73
- name : Clippy
45
74
env :
46
75
RUSTFLAGS : -Dwarnings
47
76
run : cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*"
77
+
48
78
- name : Build all bindings
49
79
run : cargo build --all-features -p cust_raw
50
- - name : Build
80
+
81
+ - name : Build workspace
51
82
run : cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*"
83
+
52
84
- name : Check documentation
53
85
env :
54
86
RUSTDOCFLAGS : -Dwarnings
55
87
run : cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*" --exclude "cust_raw"
88
+
89
+ - name : Prepare artifact details
90
+ id : artifact_details
91
+ run : |
92
+ SANITIZED_NAME=$(echo '${{ matrix.variance.name }}' | sed 's/[^a-zA-Z0-9.-]/-/g')
93
+ ARTIFACT_NAME="target_debug-${SANITIZED_NAME}-${{ github.run_id }}"
94
+ ARTIFACT_PATH="target/debug"
95
+ echo "name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
96
+ echo "path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
97
+
98
+ - name : Upload build artifacts
99
+ uses : actions/upload-artifact@v4
100
+ with :
101
+ name : ${{ steps.artifact_details.outputs.name }}
102
+ path : ${{ steps.artifact_details.outputs.path }}
103
+ retention-days : 1
104
+
105
+ test :
106
+ name : Test / ${{ matrix.variance.name }}
107
+ # Depends on the build job
108
+ needs : build
109
+ # Run ONLY IF:
110
+ # - The corresponding 'build' job succeeded AND
111
+ # - EITHER:
112
+ # - Event is 'push' to 'main'
113
+ # - OR Event is 'workflow_dispatch'
114
+ # - OR Event is 'pull_request' AND the 'actor_has_write_permission' output from build is 'true'
115
+ if : >
116
+ needs.build.result == 'success' &&
117
+ (
118
+ (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
119
+ github.event_name == 'workflow_dispatch' ||
120
+ (github.event_name == 'pull_request' && needs.build.outputs.actor_has_write_permission == 'true')
121
+ )
122
+ runs-on : ubuntu-latest
123
+ # Use the exact same container image as the build job
124
+ container :
125
+ image : ${{ matrix.variance.image }}
126
+ strategy :
127
+ # Save some credits
128
+ fail-fast : true
129
+ matrix :
130
+ variance :
131
+ # Must match the build job's matrix definition
132
+ # - name: Ubuntu-22.04 / CUDA-11.8.0 image:
133
+ # "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda11:latest"
134
+ - name : Ubuntu-22.04 / CUDA-12.8.1
135
+ image : " ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda12:latest"
136
+ - name : Ubuntu-24.04 / CUDA-12.8.1
137
+ image : " ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
138
+ - name : RockyLinux-9 / CUDA-12.8.1
139
+ image : " ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest"
140
+ steps :
141
+ - name : Download build artifacts
142
+ uses : actions/download-artifact@v4
143
+ with :
144
+ name : ${{ needs.build.outputs.artifact_name }}
145
+ path : ${{ needs.build.outputs.artifact_path }}
146
+
147
+ - name : List downloaded files
148
+ run : ls -lR ${{ needs.build.outputs.artifact_path }}
149
+
150
+ - name : Run remote tests
151
+ env :
152
+ MODAL_TOKEN_ID : ${{ secrets.MODAL_TOKEN_ID }}
153
+ MODAL_TOKEN_SECRET : ${{ secrets.MODAL_TOKEN_SECRET }}
154
+ run : |
155
+ echo "Stubbed out"
0 commit comments