Skip to content

Commit 10a60db

Browse files
antonbaliasnikovhedgar2017
authored andcommitted
ci: disable build job completely if required is false
[skip ci]
1 parent b307d5b commit 10a60db

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

.github/workflows/build-binaries.yml

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build LLVM binaries
22

33
on:
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:
@@ -38,46 +38,52 @@ on:
3838

3939
jobs:
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"
@@ -89,11 +95,9 @@ jobs:
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 }}

.github/workflows/regression-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Regression tests
22

33
on:
44
pull_request:
5-
# branches:
6-
# - main
5+
branches:
6+
- main
77
workflow_dispatch:
88
inputs:
99
commits-to-test:

0 commit comments

Comments
 (0)