38
38
if : github.repository == 'llvm/llvm-project'
39
39
outputs :
40
40
release-version : ${{ steps.vars.outputs.release-version }}
41
- flags : ${{ steps.vars.outputs.flags }}
42
- build-dir : ${{ steps.vars.outputs.build-dir }}
43
- rc-flags : ${{ steps.vars.outputs.rc-flags }}
44
41
ref : ${{ steps.vars.outputs.ref }}
45
42
upload : ${{ steps.vars.outputs.upload }}
46
43
@@ -85,17 +82,11 @@ jobs:
85
82
fi
86
83
bash .github/workflows/set-release-binary-outputs.sh "$tag" "$upload"
87
84
88
- # Try to get around the 6 hour timeout by first running a job to fill
89
- # the build cache.
90
- fill-cache :
91
- name : " Fill Cache ${{ matrix.os }}"
85
+ build-stage1-linux :
86
+ name : " Build Stage 1 Linux"
92
87
needs : prepare
93
- runs-on : ${{ matrix.os }}
88
+ runs-on : ubuntu-22.04
94
89
if : github.repository == 'llvm/llvm-project'
95
- strategy :
96
- matrix :
97
- os :
98
- - ubuntu-22.04
99
90
steps :
100
91
- name : Checkout LLVM
101
92
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -109,81 +100,207 @@ jobs:
109
100
uses : hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
110
101
with :
111
102
max-size : 250M
112
- key : sccache-${{ matrix .os }}-release
103
+ key : sccache-${{ runner .os }}-release
113
104
variant : sccache
114
105
115
- - name : Build Clang
106
+ - name : Build Stage 1 Clang
116
107
run : |
117
- cmake -G Ninja -C clang/cmake/caches/Release.cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_POSITION_INDEPENDENT_CODE=ON -S llvm -B build
118
- ninja -v -C build clang
108
+ sudo chown $USER:$USER /mnt/
109
+ cmake -G Ninja -C clang/cmake/caches/Release.cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -S llvm -B /mnt/build
110
+ ninja -v -C /mnt/build
119
111
112
+ # We need to create an archive of the build directory, because it has too
113
+ # many files to upload.
114
+ - name : Package Build and Source Directories
115
+ run : |
116
+ tar -c . | zstd -T0 -c > llvm-project.tar.zst
117
+ tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst
120
118
121
- build-binaries :
122
- name : ${{ matrix.target.triple }}
123
- permissions :
124
- contents : write # To upload assets to release.
119
+ - name : Upload Stage 1 Source
120
+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
121
+ with :
122
+ name : stage1-source
123
+ path : llvm-project.tar.zst
124
+ retention-days : 2
125
+
126
+ - name : Upload Stage 1 Build Dir
127
+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
128
+ with :
129
+ name : stage1-build
130
+ path : build.tar.zst
131
+ retention-days : 2
132
+
133
+ build-stage2-linux :
134
+ name : " Build Stage 2 Linux"
125
135
needs :
126
136
- prepare
127
- - fill-cache
128
- runs-on : ${{ matrix.target.runs-on }}
137
+ - build-stage1-linux
138
+ runs-on : ubuntu-22.04
129
139
if : github.repository == 'llvm/llvm-project'
130
- strategy :
131
- fail-fast : false
132
- matrix :
133
- target :
134
- - triple : x86_64-linux-gnu-ubuntu-22.04
135
- os : ubuntu-22.04
136
- runs-on : ubuntu-22.04-16x64
137
- debian-build-deps : >
138
- chrpath
139
- gcc-multilib
140
- ninja-build
141
-
142
140
steps :
143
- - name : Checkout LLVM
144
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
141
+ - name : Install Ninja
142
+ uses : llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
143
+
144
+ - name : Download Stage 1 Artifacts
145
+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
145
146
with :
146
- ref : ${{ needs.prepare.outputs.ref }}
147
- path : ${{ needs.prepare.outputs.build-dir }}/llvm-project
147
+ pattern : stage1-*
148
+ merge-multiple : true
148
149
149
- - name : Setup sccache
150
- uses : hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
150
+ - name : Unpack Artifacts
151
+ run : |
152
+ tar --zstd -xf llvm-project.tar.zst
153
+ rm llvm-project.tar.zst
154
+ sudo chown $USER:$USER /mnt/
155
+ tar --zstd -C /mnt -xf build.tar.zst
156
+ rm build.tar.zst
157
+
158
+ - name : Build Stage 2
159
+ run : |
160
+ ninja -C /mnt/build stage2-instrumented
161
+
162
+ # We need to create an archive of the build directory, because it has too
163
+ # many files to upload.
164
+ - name : Save Build and Source Directories
165
+ run : |
166
+ tar -c . | zstd -T0 -c > llvm-project.tar.zst
167
+ tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst
168
+
169
+ - name : Upload Stage 2 Source
170
+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
151
171
with :
152
- max-size : 250M
153
- key : sccache-${{ matrix.target.os }}-release
154
- save : false
155
- variant : sccache
172
+ name : stage2-source
173
+ path : ${{ github.workspace }}/llvm-project.tar.zst
174
+ retention-days : 2
175
+
176
+ - name : Upload Stage 2 Build Dir
177
+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
178
+ with :
179
+ name : stage2-build
180
+ path : ${{ github.workspace }}/build.tar.zst
181
+ retention-days : 2
156
182
157
- - name : Install Brew build dependencies
158
- if : matrix.target.brew-build-deps != ''
159
- run : brew install ${{ matrix.target.brew-build-deps }}
160
183
161
- - name : Install Debian build dependencies
162
- if : matrix.target.debian-build-deps != ''
163
- run : sudo apt install ${{ matrix.target.debian-build-deps }}
184
+ build-stage3-linux :
185
+ name : " Build Stage 3 Linux"
186
+ needs :
187
+ - prepare
188
+ - build-stage2-linux
189
+ outputs :
190
+ filename : ${{ steps.package-info.outputs.release-filename }}
191
+ runs-on : ubuntu-22.04-16x64
192
+ if : github.repository == 'llvm/llvm-project'
193
+ steps :
194
+ - name : Install Ninja
195
+ uses : llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
196
+
197
+ - name : ' Download artifact'
198
+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
199
+ with :
200
+ pattern : stage2-*
201
+ merge-multiple : true
164
202
165
- - name : Set macOS build env variables
166
- if : runner.os == 'macOS'
203
+ - name : Unpack Artifact
167
204
run : |
168
- echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"
205
+ tar --zstd -xf llvm-project.tar.zst
206
+ rm llvm-project.tar.zst
207
+ sudo chown $USER:$USER /mnt/
208
+ tar --zstd -C /mnt -xf build.tar.zst
209
+ rm build.tar.zst
169
210
170
- - name : Build and test release
211
+ - name : Build Release Package
171
212
run : |
172
- ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/test-release.sh \
173
- ${{ needs.prepare.outputs.flags }} \
174
- -triple ${{ matrix.target.triple }} \
175
- -use-ninja \
176
- -no-checkout \
177
- -use-cmake-cache \
178
- -no-test-suite \
179
- -configure-flags "-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
213
+ ninja -C /mnt/build stage2-package
180
214
181
- - name : Upload binaries
182
- if : ${{ always() && needs.prepare.outputs.upload == 'true' }}
215
+ - id : package-info
216
+ run : |
217
+ filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.gz"
218
+ echo "filename=$filename" >> $GITHUB_OUTPUT
219
+ echo "path=/mnt/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
220
+
221
+ - uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
222
+ if : always()
223
+ with :
224
+ name : release-binary
225
+ path : ${{ steps.package-info.outputs.path }}
226
+
227
+ # Clean up some build files to reduce size of artifact.
228
+ - name : Clean Up Build Directory
229
+ run : |
230
+ find /mnt/build -iname ${{ steps.package-info.outputs.filename }} -delete
231
+
232
+ # We need to create an archive of the build directory, because it has too
233
+ # many files to upload.
234
+ - name : Save Build and Source Directories
235
+ run : |
236
+ tar -c . | zstd -T0 -c > llvm-project.tar.zst
237
+ tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst
238
+
239
+ - name : Upload Stage 3 Source
240
+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
241
+ with :
242
+ name : stage3-source
243
+ path : llvm-project.tar.zst
244
+ retention-days : 2
245
+
246
+ - name : Upload Stage 3 Build Dir
247
+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
248
+ with :
249
+ name : stage3-build
250
+ path : build.tar.zst
251
+ retention-days : 2
252
+
253
+ upload-release-binaries-linux :
254
+ name : " Upload Linux Release Binaries"
255
+ needs :
256
+ - prepare
257
+ - build-stage3-linux
258
+ if : ${{ needs.prepare.outputs.upload == 'true' }}
259
+ runs-on : ubuntu-22.04
260
+ permissions :
261
+ contents : write # For release uploads
262
+
263
+ steps :
264
+ - name : ' Download artifact'
265
+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
266
+ with :
267
+ name : release-binary
268
+
269
+ - name : Upload Release
183
270
run : |
184
271
sudo apt install python3-github
185
- ${{ needs.prepare.outputs.build-dir }} /llvm-project/llvm/utils/release/github-upload-release.py \
272
+ . /llvm-project/llvm/utils/release/github-upload-release.py \
186
273
--token ${{ github.token }} \
187
274
--release ${{ needs.prepare.outputs.release-version }} \
188
275
upload \
189
- --files ${{ needs.prepare.outputs.build-dir }}/clang+llvm-${{ needs.prepare.outputs.release-version }}-${{ matrix.target.triple }}.tar.xz
276
+ --files ${{ needs.build-stage3-linux.outputs.release-filename }}
277
+
278
+
279
+ test-stage3-linux :
280
+ name : " Test Stage 3 Linux"
281
+ needs :
282
+ - prepare
283
+ - build-stage3-linux
284
+ runs-on : ubuntu-22.04
285
+ if : github.repository == 'llvm/llvm-project'
286
+ steps :
287
+ - name : Install Ninja
288
+ uses : llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
289
+
290
+ - name : ' Download artifact'
291
+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
292
+ with :
293
+ pattern : stage3-*
294
+ merge-multiple : true
295
+
296
+ - name : Unpack Artifact
297
+ run : |
298
+ tar --zstd -xf llvm-project.tar.zst
299
+ rm llvm-project.tar.zst
300
+ sudo chown $USER:$USER /mnt/
301
+ tar --zstd -C /mnt -xf build.tar.zst
302
+ rm build.tar.zst
303
+
304
+ - name : Run Tests
305
+ run : |
306
+ ninja -C /mnt/build stage2-check-all
0 commit comments