Skip to content

Commit c4b9978

Browse files
committed
Fix bulid-prefix
1 parent 745f8f1 commit c4b9978

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

.github/workflows/release-binaries.yml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,25 @@ jobs:
111111
variant: sccache
112112

113113
- name: Build Stage 1 Clang
114+
id: build
114115
shell: bash
115116
run: |
116-
sudo chown $USER:$USER /mnt/
117-
cmake -G Ninja -C clang/cmake/caches/Release.cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -S llvm -B /mnt/build
118-
ninja -v -C /mnt/build
117+
build_prefix=`pwd`
118+
if [ "${{ runner.os }}" = "Linux" ]; then
119+
sudo chown $USER:$USER /mnt/
120+
build_prefix=/mnt/
121+
fi
122+
cmake -G Ninja -C clang/cmake/caches/Release.cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -S llvm -B $build_prefix/build
123+
ninja -v -C $build_prefix/build
124+
echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
119125
120126
# We need to create an archive of the build directory, because it has too
121127
# many files to upload.
122128
- name: Package Build and Source Directories
123129
shell: bash
124130
run: |
125131
tar -c . | zstd -T0 -c > llvm-project.tar.zst
126-
tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst
132+
tar ${{ steps.build.outputs.build_prefix }} -c build/ | zstd -T0 -c > build.tar.zst
127133
128134
- name: Upload Stage 1 Source
129135
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
@@ -165,26 +171,32 @@ jobs:
165171

166172
- name: Unpack Artifacts
167173
shell: bash
174+
id: unpack
168175
run: |
176+
build_prefix=`pwd`
177+
if [ "${{ runner.os }}" = "Linux" ]; then
178+
sudo chown $USER:$USER /mnt/
179+
build_prefix=/mnt/
180+
fi
169181
tar --zstd -xf llvm-project.tar.zst
170182
rm llvm-project.tar.zst
171-
sudo chown $USER:$USER /mnt/
172-
tar --zstd -C /mnt -xf build.tar.zst
183+
tar --zstd -C $build_prefix -xf build.tar.zst
173184
rm build.tar.zst
185+
echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
174186
175187
- name: Build Stage 2
176188
if: false
177189
shell: bash
178190
run: |
179-
ninja -C /mnt/build stage2-instrumented
191+
ninja -C ${{ steps.unpack.outputs.build-prefix}}/build stage2-instrumented
180192
181193
# We need to create an archive of the build directory, because it has too
182194
# many files to upload.
183195
- name: Save Build and Source Directories
184196
shell: bash
185197
run: |
186198
tar -c . | zstd -T0 -c > llvm-project.tar.zst
187-
tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst
199+
tar -C ${{ steps.unpack.outputs.build-prefix }} -c build/ | zstd -T0 -c > build.tar.zst
188200
189201
- name: Upload Stage 2 Source
190202
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
@@ -229,12 +241,18 @@ jobs:
229241

230242
- name: Unpack Artifact
231243
shell: bash
244+
id: unpack
232245
run: |
246+
build_prefix=`pwd`
247+
if [ "${{ runner.os }}" = "Linux" ]; then
248+
sudo chown $USER:$USER /mnt/
249+
build_prefix=/mnt/
250+
fi
233251
tar --zstd -xf llvm-project.tar.zst
234252
rm llvm-project.tar.zst
235-
sudo chown $USER:$USER /mnt/
236-
tar --zstd -C /mnt -xf build.tar.zst
253+
tar --zstd -C $build_prefix -xf build.tar.zst
237254
rm build.tar.zst
255+
echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
238256
239257
- name: Timeout Restore
240258
id: timeout
@@ -245,7 +263,7 @@ jobs:
245263
- name: Build Release Package
246264
shell: bash
247265
run: |
248-
ninja -C /mnt/build stage2-package
266+
ninja -C ${{ steps.unpack.outputs.build-preifx }}/build stage2-package
249267
250268
- name: Timeout Save
251269
if: always()
@@ -261,7 +279,7 @@ jobs:
261279
run: |
262280
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.gz"
263281
echo "filename=$filename" >> $GITHUB_OUTPUT
264-
echo "path=/mnt/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
282+
echo "path=${{ steps.unpack.outputs.build-prefix }}/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
265283
266284
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
267285
if: always()
@@ -273,15 +291,15 @@ jobs:
273291
- name: Clean Up Build Directory
274292
shell: bash
275293
run: |
276-
find /mnt/build -iname ${{ steps.package-info.outputs.filename }} -delete
294+
find ${{ steps.unpack.outputs.build-prefix }}/build -iname ${{ steps.package-info.outputs.filename }} -delete
277295
278296
# We need to create an archive of the build directory, because it has too
279297
# many files to upload.
280298
- name: Save Build and Source Directories
281299
shell: bash
282300
run: |
283301
tar -c . | zstd -T0 -c > llvm-project.tar.zst
284-
tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst
302+
tar -C ${{ steps.unpack.outputs.build-prefix }} -c build/ | zstd -T0 -c > build.tar.zst
285303
286304
- name: Upload Stage 3 Source
287305
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
@@ -350,14 +368,20 @@ jobs:
350368

351369
- name: Unpack Artifact
352370
shell: bash
371+
id: unpack
353372
run: |
373+
build_prefix=`pwd`
374+
if [ "${{ runner.os }}" = "Linux" ]; then
375+
sudo chown $USER:$USER /mnt/
376+
build_prefix=/mnt/
377+
fi
354378
tar --zstd -xf llvm-project.tar.zst
355379
rm llvm-project.tar.zst
356-
sudo chown $USER:$USER /mnt/
357-
tar --zstd -C /mnt -xf build.tar.zst
380+
tar --zstd -C $build_prefix -xf build.tar.zst
358381
rm build.tar.zst
382+
echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
359383
360384
- name: Run Tests
361385
shell: bash
362386
run: |
363-
ninja -C /mnt/build stage2-check-all
387+
ninja -C ${{ steps.unpack.outputs.build-prefix }}/build stage2-check-all

0 commit comments

Comments
 (0)