@@ -35,23 +35,26 @@ jobs:
3535 prepare :
3636 name : Prepare to build binaries
3737 runs-on : ubuntu-22.04
38+ if : github.repository == 'llvm/llvm-project'
3839 outputs :
3940 release-version : ${{ steps.vars.outputs.release-version }}
40- flags : ${{ steps.vars.outputs.flags }}
41- build-dir : ${{ steps.vars.outputs.build-dir }}
42- rc-flags : ${{ steps.vars.outputs.rc-flags }}
4341 ref : ${{ steps.vars.outputs.ref }}
4442 upload : ${{ steps.vars.outputs.upload }}
4543
4644 steps :
4745 - name : Checkout LLVM
4846 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4947
48+ - name : Install Dependencies
49+ run : |
50+ pip install -r ./llvm/utils/git/requirements.txt
51+
5052 - name : Check Permissions
5153 env :
5254 GITHUB_TOKEN : ${{ github.token }}
55+ USER_TOKEN : ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
5356 run : |
54- ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
57+ ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
5558
5659 - name : Collect Variables
5760 id : vars
6568 # | X.Y.Z | -final
6669 run : |
6770 tag="${{ github.ref_name }}"
68- trimmed=$(echo ${{ inputs.tag }} | xargs)
69- [[ "$trimmed" != "" ]] && tag="$trimmed"
71+ trimmed=$(echo ${{ inputs.release-version }} | xargs)
72+ [[ "$trimmed" != "" ]] && tag="llvmorg- $trimmed"
7073 if [ "$tag" = "main" ]; then
7174 # If tag is main, then we've been triggered by a scheduled so pass so
7275 # use the head commit as the tag.
@@ -79,16 +82,11 @@ jobs:
7982 fi
8083 bash .github/workflows/set-release-binary-outputs.sh "$tag" "$upload"
8184
82- # Try to get around the 6 hour timeout by first running a job to fill
83- # the build cache.
84- fill-cache :
85- name : " Fill Cache ${{ matrix.os }}"
85+ build-stage1-linux :
86+ name : " Build Stage 1 Linux"
8687 needs : prepare
87- runs-on : ${{ matrix.os }}
88- strategy :
89- matrix :
90- os :
91- - ubuntu-22.04
88+ runs-on : ubuntu-22.04
89+ if : github.repository == 'llvm/llvm-project'
9290 steps :
9391 - name : Checkout LLVM
9492 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -102,80 +100,207 @@ jobs:
102100 uses : hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
103101 with :
104102 max-size : 250M
105- key : sccache-${{ matrix .os }}-release
103+ key : sccache-${{ runner .os }}-release
106104 variant : sccache
107105
108- - name : Build Clang
106+ - name : Build Stage 1 Clang
109107 run : |
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 build
111- 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
112111
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
113118
114- build-binaries :
115- name : ${{ matrix.target.triple }}
116- permissions :
117- 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"
118135 needs :
119136 - prepare
120- - fill-cache
121- runs-on : ${{ matrix.target.runs-on }}
122- strategy :
123- fail-fast : false
124- matrix :
125- target :
126- - triple : x86_64-linux-gnu-ubuntu-22.04
127- os : ubuntu-22.04
128- runs-on : ubuntu-22.04-16x64
129- debian-build-deps : >
130- chrpath
131- gcc-multilib
132- ninja-build
133-
137+ - build-stage1-linux
138+ runs-on : ubuntu-22.04
139+ if : github.repository == 'llvm/llvm-project'
134140 steps :
135- - name : Checkout LLVM
136- 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
137146 with :
138- ref : ${{ needs.prepare.outputs.ref }}
139- path : ${{ needs.prepare.outputs.build-dir }}/llvm-project
147+ pattern : stage1-*
148+ merge-multiple : true
140149
141- - name : Setup sccache
142- 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
143171 with :
144- max-size : 250M
145- key : sccache-${{ matrix.target.os }}-release
146- save : false
147- variant : sccache
172+ name : stage2-source
173+ path : ${{ github.workspace }}/llvm-project.tar.zst
174+ retention-days : 2
148175
149- - name : Install Brew build dependencies
150- if : matrix.target.brew-build-deps != ''
151- run : brew install ${{ matrix.target.brew-build-deps }}
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
152182
153- - name : Install Debian build dependencies
154- if : matrix.target.debian-build-deps != ''
155- run : sudo apt install ${{ matrix.target.debian-build-deps }}
156183
157- - name : Set macOS build env variables
158- if : runner.os == 'macOS'
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
202+
203+ - name : Unpack Artifact
204+ run : |
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
210+
211+ - name : Build Release Package
159212 run : |
160- echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"
213+ ninja -C /mnt/build stage2-package
161214
162- - name : Build and test release
215+ - id : package-info
163216 run : |
164- ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/test-release.sh \
165- ${{ needs.prepare.outputs.flags }} \
166- -triple ${{ matrix.target.triple }} \
167- -use-ninja \
168- -no-checkout \
169- -use-cmake-cache \
170- -no-test-suite \
171- -configure-flags "-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
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 }}
172226
173- - name : Upload binaries
174- if : ${{ always() && needs.prepare.outputs.upload == 'true' }}
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
175270 run : |
176271 sudo apt install python3-github
177- ${{ needs.prepare.outputs.build-dir }} /llvm-project/llvm/utils/release/github-upload-release.py \
272+ . /llvm-project/llvm/utils/release/github-upload-release.py \
178273 --token ${{ github.token }} \
179274 --release ${{ needs.prepare.outputs.release-version }} \
180275 upload \
181- --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