|
| 1 | +name: Release Binaries |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'llvmorg-*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + upload: |
| 10 | + description: 'Upload binaries to the release page' |
| 11 | + required: true |
| 12 | + default: true |
| 13 | + type: boolean |
| 14 | + tag: |
| 15 | + description: 'Tag to build' |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read # Default everything to read-only |
| 21 | + |
| 22 | +jobs: |
| 23 | + prepare: |
| 24 | + name: Prepare to build binaries |
| 25 | + runs-on: ubuntu-22.04 |
| 26 | + if: github.repository == 'llvm/llvm-project' |
| 27 | + outputs: |
| 28 | + release-version: ${{ steps.validate-tag.outputs.release-version }} |
| 29 | + release: ${{ steps.validate-tag.outputs.release }} |
| 30 | + build-dir: ${{ steps.validate-tag.outputs.build-dir }} |
| 31 | + rc-flags: ${{ steps.validate-tag.outputs.rc-flags }} |
| 32 | + ref: ${{ steps.validate-tag.outputs.ref }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout LLVM |
| 36 | + uses: actions/checkout@v3 |
| 37 | + |
| 38 | + - name: Validate and parse tag |
| 39 | + id: validate-tag |
| 40 | + # In order for the test-release.sh script to run correctly, the LLVM |
| 41 | + # source needs to be at the following location relative to the build dir: |
| 42 | + # | X.Y.Z-rcN | ./rcN/llvm-project |
| 43 | + # | X.Y.Z | ./final/llvm-project |
| 44 | + # |
| 45 | + # We also need to set divergent flags based on the release version: |
| 46 | + # | X.Y.Z-rcN | -rc N -test-asserts |
| 47 | + # | X.Y.Z | -final |
| 48 | + run: | |
| 49 | + tag="${{ github.ref_name }}" |
| 50 | + trimmed=`echo ${{ inputs.tag }} | xargs` |
| 51 | + [[ "$trimmed" != "" ]] && tag="$trimmed" |
| 52 | + if [ -n "${{ inputs.upload }}" ]; then |
| 53 | + upload="${{ inputs.upload }}" |
| 54 | + else |
| 55 | + upload="true" |
| 56 | + fi |
| 57 | + bash .github/workflows/set-release-binary-outputs.sh "${{ github.actor }}" "$tag" "$upload" |
| 58 | +
|
| 59 | + build-binaries: |
| 60 | + name: ${{ matrix.target.triple }} |
| 61 | + permissions: |
| 62 | + contents: write # To upload assets to release. |
| 63 | + needs: prepare |
| 64 | + runs-on: ${{ matrix.target.runs-on }} |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + target: |
| 69 | + - triple: x86_64-linux-gnu-ubuntu-22.04 |
| 70 | + runs-on: ubuntu-22.04-8x32 |
| 71 | + debian-build-deps: > |
| 72 | + chrpath |
| 73 | + gcc-multilib |
| 74 | + ninja-build |
| 75 | +
|
| 76 | + steps: |
| 77 | + - name: Checkout LLVM |
| 78 | + uses: actions/checkout@v3 |
| 79 | + with: |
| 80 | + ref: ${{ needs.prepare.outputs.ref }} |
| 81 | + path: ${{ needs.prepare.outputs.build-dir }}/llvm-project |
| 82 | + |
| 83 | + - name: Install Brew build dependencies |
| 84 | + if: matrix.target.brew-build-deps != '' |
| 85 | + run: brew install ${{ matrix.target.brew-build-deps }} |
| 86 | + |
| 87 | + - name: Install Debian build dependencies |
| 88 | + if: matrix.target.debian-build-deps != '' |
| 89 | + run: sudo apt install ${{ matrix.target.debian-build-deps }} |
| 90 | + |
| 91 | + - name: Set macOS build env variables |
| 92 | + if: runner.os == 'macOS' |
| 93 | + run: | |
| 94 | + echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV |
| 95 | +
|
| 96 | + - name: Build and test release |
| 97 | + run: | |
| 98 | + ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/test-release.sh \ |
| 99 | + -release ${{ needs.prepare.outputs.release }} \ |
| 100 | + ${{ needs.prepare.outputs.rc-flags }} \ |
| 101 | + -triple ${{ matrix.target.triple }} \ |
| 102 | + -use-ninja \ |
| 103 | + -no-checkout \ |
| 104 | + -no-test-suite |
| 105 | +
|
| 106 | + - name: Upload binaries |
| 107 | + if: ${{ always() && needs.prepare.outputs.upload == 'true' }} |
| 108 | + run: | |
| 109 | + ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/github-upload-release.py \ |
| 110 | + --token ${{ github.token }} \ |
| 111 | + --release ${{ needs.prepare.outputs.release-version }} \ |
| 112 | + upload \ |
| 113 | + --files ${{ needs.prepare.outputs.build-dir }}/clang+llvm-${{ needs.prepare.outputs.release-version }}-${{ matrix.target.triple }}.tar.xz |
0 commit comments