[llvm] [Workflows] Re-write release-binaries workflow (PR #89521)
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 15:15:50 PDT 2024
================
@@ -109,81 +100,216 @@ jobs:
uses: hendrikmuhs/ccache-action at ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
with:
max-size: 250M
- key: sccache-${{ matrix.os }}-release
+ key: sccache-${{ runner.os }}-release
variant: sccache
- - name: Build Clang
+ - name: Build Stage 1 Clang
run: |
- 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
- ninja -v -C build clang
+ sudo chown $USER:$USER /mnt/
+ mkdir -p /mnt/build
+ 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
+ ninja -v -C /mnt/build
+ # We need to create an archive of the build directory, because it has too
+ # many files to upload.
+ - name: Package Build and Source Directories
+ run: |
+ tar -czf ${{ github.workspace }}/../llvm-project.tar.gz .
+ mv ../llvm-project.tar.gz ${{ github.workspace }}
+ tar -C /mnt/ -czf ${{ github.workspace }}/build.tar.gz build/
- build-binaries:
- name: ${{ matrix.target.triple }}
- permissions:
- contents: write # To upload assets to release.
+ - name: Upload Stage 1 Source
+ uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+ with:
+ name: stage1-source
+ path: ${{ github.workspace }}/llvm-project.tar.gz
+ retention-days: 2
+
+ - name: Upload Stage 1 Build Dir
+ uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+ with:
+ name: stage1-build
+ path: ${{ github.workspace }}/build.tar.gz
+ retention-days: 2
+
+ build-stage2-linux:
+ name: "Build Stage 2 Linux"
needs:
- prepare
- - fill-cache
- runs-on: ${{ matrix.target.runs-on }}
+ - build-stage1-linux
+ runs-on: ubuntu-22.04
if: github.repository == 'llvm/llvm-project'
- strategy:
- fail-fast: false
- matrix:
- target:
- - triple: x86_64-linux-gnu-ubuntu-22.04
- os: ubuntu-22.04
- runs-on: ubuntu-22.04-16x64
- debian-build-deps: >
- chrpath
- gcc-multilib
- ninja-build
-
steps:
- - name: Checkout LLVM
- uses: actions/checkout at b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+ - name: Install Ninja
+ uses: llvm/actions/install-ninja at 22e9f909d35b50bd1181709564bfe816eaeaae81 # main
+
+ - name: Download Stage 1 Artifacts
+ uses: actions/download-artifact at 6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
- ref: ${{ needs.prepare.outputs.ref }}
- path: ${{ needs.prepare.outputs.build-dir }}/llvm-project
+ pattern: stage1-*
+ merge-multiple: true
- - name: Setup sccache
- uses: hendrikmuhs/ccache-action at ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9
+ - name: Unpack Artifacts
+ run: |
+ tar -xzf llvm-project.tar.gz
+ rm llvm-project.tar.gz
+ sudo chown $USER:$USER /mnt/
+ tar -C /mnt -xzf build.tar.gz
+ rm build.tar.gz
+
+ - name: Build Stage 2
+ run: |
+ ninja -C /mnt/build stage2-instrumented
+
+ # We need to create an archive of the build directory, because it has too
+ # many files to upload.
+ - name: Save Build and Source Directories
+ run: |
+ tar -czf ${{ github.workspace }}/../llvm-project.tar.gz .
+ mv ../llvm-project.tar.gz ${{ github.workspace }}
+ tar -C /mnt/ -czf ${{ github.workspace }}/build.tar.gz build/
+
+ - name: Upload Stage 2 Source
+ uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
with:
- max-size: 250M
- key: sccache-${{ matrix.target.os }}-release
- save: false
- variant: sccache
+ name: stage2-source
+ path: ${{ github.workspace }}/llvm-project.tar.gz
+ retention-days: 2
+
+ - name: Upload Stage 2 Build Dir
+ uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+ with:
+ name: stage2-build
+ path: ${{ github.workspace }}/build.tar.gz
+ retention-days: 2
- - name: Install Brew build dependencies
- if: matrix.target.brew-build-deps != ''
- run: brew install ${{ matrix.target.brew-build-deps }}
- - name: Install Debian build dependencies
- if: matrix.target.debian-build-deps != ''
- run: sudo apt install ${{ matrix.target.debian-build-deps }}
+ build-stage3-linux:
+ name: "Build Stage 3 Linux"
+ needs:
+ - prepare
+ - build-stage2-linux
+ outputs:
+ filename: ${{ steps.package-info.outputs.release-filename }}
+ runs-on: ubuntu-22.04-16x64
+ if: github.repository == 'llvm/llvm-project'
+ steps:
+ - name: Install Ninja
+ uses: llvm/actions/install-ninja at 22e9f909d35b50bd1181709564bfe816eaeaae81 # main
+
+ - name: 'Download artifact'
+ uses: actions/download-artifact at 6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
+ with:
+ pattern: stage2-*
+ merge-multiple: true
- - name: Set macOS build env variables
- if: runner.os == 'macOS'
+ - name: Unpack Artifact
run: |
- echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"
+ tar -xzf llvm-project.tar.gz
+ rm llvm-project.tar.gz
+ sudo chown $USER:$USER /mnt/
+ tar -C /mnt -xzf build.tar.gz
+ rm build.tar.gz
- - name: Build and test release
+ - name: Build Release Package
run: |
- ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/test-release.sh \
- ${{ needs.prepare.outputs.flags }} \
- -triple ${{ matrix.target.triple }} \
- -use-ninja \
- -no-checkout \
- -use-cmake-cache \
- -no-test-suite \
- -configure-flags "-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
+ ninja -C /mnt/build stage2-package
- - name: Upload binaries
- if: ${{ always() && needs.prepare.outputs.upload == 'true' }}
+ - id: package-info
+ run: |
+ filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.Z"
+ echo "filename=$filename" >> $GITHUB_OUTPUT
+ echo "path=/mnt/build/tools/clang/stage2-instrumented-bins/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
+
+ - uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+ if: always()
+ with:
+ name: release-binary
+ path: ${{ steps.package-info.outputs.path }}
+
+ # Clean up some build files to reduce size of artifact.
+ - name: Clean Up Build Directory
+ run: |
+ find /mnt/build -iname ${{ steps.package-info.outputs.filename }} -delete
+
+ # We need to create an archive of the build directory, because it has too
----------------
tstellar wrote:
I switched to using zstd for packaging just this large binary. Do you think we should use zstd everywhere?
https://github.com/llvm/llvm-project/pull/89521
More information about the llvm-commits
mailing list