3838 if : github.repository == 'llvm/llvm-project'
3939 outputs :
4040 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 }}
4441 ref : ${{ steps.vars.outputs.ref }}
4542 upload : ${{ steps.vars.outputs.upload }}
4643
@@ -85,17 +82,11 @@ jobs:
8582 fi
8683 bash .github/workflows/set-release-binary-outputs.sh "$tag" "$upload"
8784
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"
9287 needs : prepare
93- runs-on : ${{ matrix.os }}
88+ runs-on : ubuntu-22.04
9489 if : github.repository == 'llvm/llvm-project'
95- strategy :
96- matrix :
97- os :
98- - ubuntu-22.04
9990 steps :
10091 - name : Checkout LLVM
10192 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -109,81 +100,216 @@ jobs:
109100 uses : hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
110101 with :
111102 max-size : 250M
112- key : sccache-${{ matrix .os }}-release
103+ key : sccache-${{ runner .os }}-release
113104 variant : sccache
114105
115- - name : Build Clang
106+ - name : Build Stage 1 Clang
116107 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+ mkdir -p /mnt/build
110+ 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 /mnt/build
111+ ninja -v -C /mnt/build
119112
113+ # We need to create an archive of the build directory, because it has too
114+ # many files to upload.
115+ - name : Package Build and Source Directories
116+ run : |
117+ tar -czf ${{ github.workspace }}/../llvm-project.tar.gz .
118+ mv ../llvm-project.tar.gz ${{ github.workspace }}
119+ tar -C /mnt/ -czf ${{ github.workspace }}/build.tar.gz build/
120120
121- build-binaries :
122- name : ${{ matrix.target.triple }}
123- permissions :
124- contents : write # To upload assets to release.
121+ - name : Upload Stage 1 Source
122+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
123+ with :
124+ name : stage1-source
125+ path : ${{ github.workspace }}/llvm-project.tar.gz
126+ retention-days : 2
127+
128+ - name : Upload Stage 1 Build Dir
129+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
130+ with :
131+ name : stage1-build
132+ path : ${{ github.workspace }}/build.tar.gz
133+ retention-days : 2
134+
135+ build-stage2-linux :
136+ name : " Build Stage 2 Linux"
125137 needs :
126138 - prepare
127- - fill-cache
128- runs-on : ${{ matrix.target.runs-on }}
139+ - build-stage1-linux
140+ runs-on : ubuntu-22.04
129141 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-
142142 steps :
143- - name : Checkout LLVM
144- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
143+ - name : Install Ninja
144+ uses : llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
145+
146+ - name : Download Stage 1 Artifacts
147+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
145148 with :
146- ref : ${{ needs.prepare.outputs.ref }}
147- path : ${{ needs.prepare.outputs.build-dir }}/llvm-project
149+ pattern : stage1-*
150+ merge-multiple : true
148151
149- - name : Setup sccache
150- uses : hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
152+ - name : Unpack Artifacts
153+ run : |
154+ tar -xzf llvm-project.tar.gz
155+ rm llvm-project.tar.gz
156+ sudo chown $USER:$USER /mnt/
157+ tar -C /mnt -xzf build.tar.gz
158+ rm build.tar.gz
159+
160+ - name : Build Stage 2
161+ run : |
162+ ninja -C /mnt/build stage2-instrumented
163+
164+ # We need to create an archive of the build directory, because it has too
165+ # many files to upload.
166+ - name : Save Build and Source Directories
167+ run : |
168+ tar -czf ${{ github.workspace }}/../llvm-project.tar.gz .
169+ mv ../llvm-project.tar.gz ${{ github.workspace }}
170+ tar -C /mnt/ -czf ${{ github.workspace }}/build.tar.gz build/
171+
172+ - name : Upload Stage 2 Source
173+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
151174 with :
152- max-size : 250M
153- key : sccache-${{ matrix.target.os }}-release
154- save : false
155- variant : sccache
175+ name : stage2-source
176+ path : ${{ github.workspace }}/llvm-project.tar.gz
177+ retention-days : 2
178+
179+ - name : Upload Stage 2 Build Dir
180+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
181+ with :
182+ name : stage2-build
183+ path : ${{ github.workspace }}/build.tar.gz
184+ retention-days : 2
156185
157- - name : Install Brew build dependencies
158- if : matrix.target.brew-build-deps != ''
159- run : brew install ${{ matrix.target.brew-build-deps }}
160186
161- - name : Install Debian build dependencies
162- if : matrix.target.debian-build-deps != ''
163- run : sudo apt install ${{ matrix.target.debian-build-deps }}
187+ build-stage3-linux :
188+ name : " Build Stage 3 Linux"
189+ needs :
190+ - prepare
191+ - build-stage2-linux
192+ outputs :
193+ filename : ${{ steps.package-info.outputs.release-filename }}
194+ runs-on : ubuntu-22.04-16x64
195+ if : github.repository == 'llvm/llvm-project'
196+ steps :
197+ - name : Install Ninja
198+ uses : llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
199+
200+ - name : ' Download artifact'
201+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
202+ with :
203+ pattern : stage2-*
204+ merge-multiple : true
164205
165- - name : Set macOS build env variables
166- if : runner.os == 'macOS'
206+ - name : Unpack Artifact
167207 run : |
168- echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"
208+ tar -xzf llvm-project.tar.gz
209+ rm llvm-project.tar.gz
210+ sudo chown $USER:$USER /mnt/
211+ tar -C /mnt -xzf build.tar.gz
212+ rm build.tar.gz
169213
170- - name : Build and test release
214+ - name : Build Release Package
171215 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"
216+ ninja -C /mnt/build stage2-package
180217
181- - name : Upload binaries
182- if : ${{ always() && needs.prepare.outputs.upload == 'true' }}
218+ - id : package-info
219+ run : |
220+ filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.Z"
221+ echo "filename=$filename" >> $GITHUB_OUTPUT
222+ echo "path=/mnt/build/tools/clang/stage2-instrumented-bins/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
223+
224+ - uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
225+ if : always()
226+ with :
227+ name : release-binary
228+ path : ${{ steps.package-info.outputs.path }}
229+
230+ # Clean up some build files to reduce size of artifact.
231+ - name : Clean Up Build Directory
232+ run : |
233+ find /mnt/build -iname ${{ steps.package-info.outputs.filename }} -delete
234+
235+ # We need to create an archive of the build directory, because it has too
236+ # many files to upload.
237+ - name : Save Build and Source Directories
238+ run : |
239+ sudo apt-get update
240+ sudo apt-get install pbzip2
241+ tar -czf ${{ github.workspace }}/../llvm-project.tar.gz .
242+ mv ../llvm-project.tar.gz ${{ github.workspace }}
243+ # Use bzip2 for better compression since this file will be huge.
244+ tar -C /mnt/ -c build/ | pbzip2 -c > ${{ github.workspace }}/build.tar.bz2
245+
246+ - name : Upload Stage 3 Source
247+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
248+ with :
249+ name : stage3-source
250+ path : ${{ github.workspace }}/llvm-project.tar.gz
251+ retention-days : 2
252+
253+ - name : Upload Stage 3 Build Dir
254+ uses : actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
255+ with :
256+ name : stage3-build
257+ path : ${{ github.workspace }}/build.tar.bz2
258+ retention-days : 2
259+
260+ upload-release-binaries-linux :
261+ name : " Upload Linux Release Binaries"
262+ needs :
263+ - prepare
264+ - build-stage3-linux
265+ if : ${{ needs.prepare.outputs.upload == 'true' }}
266+ runs-on : ubuntu-22.04
267+ permissions :
268+ contents : write # For release uploads
269+
270+ steps :
271+ - name : ' Download artifact'
272+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
273+ with :
274+ name : release-binary
275+
276+ - name : Upload Release
183277 run : |
184278 sudo apt install python3-github
185- ${{ needs.prepare.outputs.build-dir }} /llvm-project/llvm/utils/release/github-upload-release.py \
279+ . /llvm-project/llvm/utils/release/github-upload-release.py \
186280 --token ${{ github.token }} \
187281 --release ${{ needs.prepare.outputs.release-version }} \
188282 upload \
189- --files ${{ needs.prepare.outputs.build-dir }}/clang+llvm-${{ needs.prepare.outputs.release-version }}-${{ matrix.target.triple }}.tar.xz
283+ --files ${{ needs.build-stage3-linux.outputs.release-filename }}
284+
285+
286+ test-stage3-linux :
287+ name : " Test Stage 3 Linux"
288+ needs :
289+ - prepare
290+ - build-stage3-linux
291+ runs-on : ubuntu-22.04
292+ if : github.repository == 'llvm/llvm-project'
293+ steps :
294+ - name : Install Ninja
295+ uses : llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
296+
297+ - name : ' Download artifact'
298+ uses : actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
299+ with :
300+ pattern : stage3-*
301+ merge-multiple : true
302+
303+ - name : Unpack Artifact
304+ run : |
305+ sudo apt-get update
306+ sudo apt-get install bzip2
307+ tar -xzf llvm-project.tar.gz
308+ rm llvm-project.tar.gz
309+ sudo chown $USER:$USER /mnt/
310+ tar -C /mnt -xjf build.tar.bz2
311+ rm build.tar.bz2
312+
313+ - name : Run Tests
314+ run : |
315+ ninja -C /mnt/build stage2-check-all
0 commit comments