Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / .github / workflows / release-binaries.yml
blobe52e52f5d3f36fafa7c2693dc98e40e6113a07ee
1 name: Release Binaries
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
19 permissions:
20   contents: read # Default everything to read-only
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       upload: ${{ steps.validate-tag.outputs.upload }}
35     steps:
36     - name: Checkout LLVM
37       uses: actions/checkout@v4
39     - name: Validate and parse tag
40       id: validate-tag
41       # In order for the test-release.sh script to run correctly, the LLVM
42       # source needs to be at the following location relative to the build dir:
43       # | X.Y.Z-rcN | ./rcN/llvm-project
44       # | X.Y.Z     | ./final/llvm-project
45       #
46       # We also need to set divergent flags based on the release version:
47       # | X.Y.Z-rcN | -rc N -test-asserts
48       # | X.Y.Z     | -final
49       run: |
50         tag="${{ github.ref_name }}"
51         trimmed=$(echo ${{ inputs.tag }} | xargs)
52         [[ "$trimmed" != "" ]] && tag="$trimmed"
53         if [ -n "${{ inputs.upload }}" ]; then
54           upload="${{ inputs.upload }}"
55         else
56           upload="true"
57         fi
58         bash .github/workflows/set-release-binary-outputs.sh "${{ github.actor }}" "$tag" "$upload"
60   build-binaries:
61     name: ${{ matrix.target.triple }}
62     permissions:
63       contents: write # To upload assets to release.
64     needs: prepare
65     runs-on: ${{ matrix.target.runs-on }}
66     strategy:
67       fail-fast: false
68       matrix:
69         target:
70           - triple: x86_64-linux-gnu-ubuntu-22.04
71             runs-on: ubuntu-22.04-16x64
72             debian-build-deps: >
73               chrpath
74               gcc-multilib
75               ninja-build
77     steps:
78     - name: Checkout LLVM
79       uses: actions/checkout@v4
80       with:
81         ref: ${{ needs.prepare.outputs.ref }}
82         path: ${{ needs.prepare.outputs.build-dir }}/llvm-project
84     - name: Install Brew build dependencies
85       if: matrix.target.brew-build-deps != ''
86       run: brew install ${{ matrix.target.brew-build-deps }}
88     - name: Install Debian build dependencies
89       if: matrix.target.debian-build-deps != ''
90       run: sudo apt install ${{ matrix.target.debian-build-deps }}
92     - name: Set macOS build env variables
93       if: runner.os == 'macOS'
94       run: |
95         echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"
97     - name: Build and test release
98       run: |
99         ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/test-release.sh \
100         -release ${{ needs.prepare.outputs.release }} \
101         ${{ needs.prepare.outputs.rc-flags }} \
102         -triple ${{ matrix.target.triple }} \
103         -use-ninja \
104         -no-checkout \
105         -no-test-suite
107     - name: Upload binaries
108       if: ${{ always() && needs.prepare.outputs.upload == 'true' }}
109       run: |
110         sudo apt install python3-github
111         ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/github-upload-release.py \
112         --token ${{ github.token }} \
113         --release ${{ needs.prepare.outputs.release-version }} \
114         upload \
115         --files ${{ needs.prepare.outputs.build-dir }}/clang+llvm-${{ needs.prepare.outputs.release-version }}-${{ matrix.target.triple }}.tar.xz