@@ -2,7 +2,7 @@ name: Build LLVM binaries
22
33on :
44 schedule :
5- - cron : ' 0 0 * * *' # every month to regenerate ccache
5+ - cron : ' 0 0 1 * *' # every month to regenerate ccache
66 workflow_dispatch :
77 inputs :
88 ref :
3838
3939jobs :
4040
41+ prepare-matrix :
42+ runs-on : ubuntu-latest
43+ outputs :
44+ matrix : ${{ steps.prepare-matrix.outputs.matrix }}
45+ steps :
46+ - name : Prepare matrix
47+ id : prepare-matrix
48+ run : |
49+ # Define general matrix parameters
50+ WINDOWS='{"name":"Windows","runner":"windows-2022-github-hosted-64core"}'
51+ MACOS_AMD64='{"name":"MacOS-x86","runner":"macos-12-large"}'
52+ MACOS_ARM64='{"name":"MacOS-arm64","runner":["self-hosted","macOS","ARM64"]}'
53+ LINUX_AMD64='{"name":"Linux-AMD64","runner":"matterlabs-ci-runner","image":"matterlabs/llvm_runner:ubuntu22-llvm17-latest"}'
54+ LINUX_ARM64='{"name":"Linux-ARM64","runner":"matterlabs-ci-runner-arm","image":"matterlabs/llvm_runner:ubuntu22-llvm17-latest"}'
55+ # Disable platforms for non-tag builds if user requested
56+ if [ ${GITHUB_EVENT_NAME} = workflow_dispatch ]; then
57+ [ ${{ github.event.inputs.build_windows_amd64 }} != true ] && WINDOWS=
58+ [ ${{ github.event.inputs.build_macos_amd64 }} != true ] && MACOS_AMD64=
59+ [ ${{ github.event.inputs.build_macos_arm64 }} != true ] && MACOS_ARM64=
60+ [ ${{ github.event.inputs.build_linux_amd64 }} != true ] && LINUX_AMD64=
61+ [ ${{ github.event.inputs.build_linux_arm64 }} != true ] && LINUX_ARM64=
62+ fi
63+ PLATFORMS=(${WINDOWS} ${MACOS_AMD64} ${MACOS_ARM64} ${LINUX_AMD64} ${LINUX_ARM64})
64+ echo "matrix={ \"include\": [ $(IFS=, ; echo "${PLATFORMS[*]}") ] }" | tee -a "${GITHUB_OUTPUT}"
65+
4166 build :
67+ needs : prepare-matrix
4268 strategy :
4369 fail-fast : false
44- matrix :
45- include :
46- - name : " MacOS x86"
47- runner : macos-12-large
48- required : ${{ github.event.inputs.build_macos_amd64 }}
49- - name : " MacOS arm64"
50- runner : [self-hosted, macOS, ARM64]
51- required : ${{ github.event.inputs.build_macos_arm64 }}
52- - name : " Linux x86"
53- runner : matterlabs-ci-runner
54- image : matterlabs/llvm_runner:ubuntu22-llvm17-latest
55- required : ${{ github.event.inputs.build_linux_amd64 }}
56- - name : " Linux ARM64"
57- runner : matterlabs-ci-runner-arm
58- image : matterlabs/llvm_runner:ubuntu22-llvm17-latest
59- required : ${{ github.event.inputs.build_linux_arm64 }}
60- - name : " Windows"
61- runner : windows-2022-github-hosted-64core
62- required : ${{ github.event.inputs.build_windows_amd64 }}
70+ matrix : ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
6371 runs-on : ${{ matrix.runner }}
6472 container :
6573 image : ${{ matrix.image || '' }} # Special workaround to allow matrix builds with optional container
6674 name : ${{ matrix.name }}
6775 steps :
6876 - name : Checkout source
69- if : matrix.required == 'true'
7077 uses : actions/checkout@v4
7178 with :
7279 ref : ${{ inputs.ref }}
7380 path : " llvm"
7481
7582 - name : Prepare Windows env
76- if : matrix.required == 'true' && runner.os == 'Windows'
83+ if : runner.os == 'Windows'
7784 uses : matter-labs/era-compiler-ci/.github/actions/prepare-msys@v1
7885
7986 - name : Build LLVM
80- if : matrix.required == 'true'
8187 uses : matter-labs/era-compiler-ci/.github/actions/build-llvm@v1
8288 with :
8389 extra-args : " \\ -DLLVM_ENABLE_WERROR=On \\ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
8995
9096 # Required to keep executable permissions for binaries
9197 - name : Prepare tarball
92- if : matrix.required == 'true'
9398 run : tar -czf ${{ runner.os }}-${{ runner.arch }}-target-final.tar.gz ./target-llvm/target-final
9499
95100 - name : Upload LLVM binaries
96- if : matrix.required == 'true'
97101 uses : actions/upload-artifact@v4
98102 with :
99103 name : llvm-bins-${{ runner.os }}-${{ runner.arch }}
0 commit comments