Skip to content

Commit aeeec90

Browse files
ci: fix issues with forks and add build binaries workflow
1 parent 34628ac commit aeeec90

File tree

5 files changed

+126
-17
lines changed

5 files changed

+126
-17
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build LLVM binaries
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # every month to regenerate ccache
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: "Git REF to use for the build"
10+
required: false
11+
type: string
12+
build_macos_amd64:
13+
description: "Build for MacOS amd64?"
14+
required: false
15+
type: boolean
16+
default: true
17+
build_macos_arm64:
18+
description: "Build for MacOS arm64?"
19+
required: false
20+
type: boolean
21+
default: true
22+
build_linux_amd64:
23+
description: "Build for Linux amd64?"
24+
required: false
25+
type: boolean
26+
default: true
27+
build_linux_arm64:
28+
description: "Build for Linux arm64?"
29+
required: false
30+
type: boolean
31+
default: true
32+
build_windows_amd64:
33+
description: "Build for Windows amd64?"
34+
required: false
35+
type: boolean
36+
default: true
37+
38+
39+
jobs:
40+
41+
build:
42+
strategy:
43+
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 }}
63+
runs-on: ${{ matrix.runner }}
64+
container:
65+
image: ${{ matrix.image || '' }} # Special workaround to allow matrix builds with optional container
66+
name: ${{ matrix.name }}
67+
steps:
68+
- name: Checkout source
69+
if: matrix.required == 'true'
70+
uses: actions/checkout@v4
71+
with:
72+
ref: ${{ inputs.ref }}
73+
path: "llvm"
74+
75+
- name: Prepare Windows env
76+
if: matrix.required == 'true' && runner.os == 'Windows'
77+
uses: matter-labs/era-compiler-ci/.github/actions/prepare-msys@v1
78+
79+
- name: Build LLVM
80+
if: matrix.required == 'true'
81+
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1
82+
with:
83+
extra-args: "\\-DLLVM_ENABLE_WERROR=On \\-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
84+
enable-tests: true
85+
enable-assertions: true
86+
clone-llvm: false
87+
ccache-key-type: 'static'
88+
save-ccache: ${{ matrix.name == 'Linux x86' }}
89+
90+
# Required to keep executable permissions for binaries
91+
- name: Prepare tarball
92+
if: matrix.required == 'true'
93+
run: tar -czf ${{ runner.os }}-${{ runner.arch }}-target-final.tar.gz ./target-llvm/target-final
94+
95+
- name: Upload LLVM binaries
96+
if: matrix.required == 'true'
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: llvm-bins-${{ runner.os }}-${{ runner.arch }}
100+
path: ./${{ runner.os }}-${{ runner.arch }}-target-final.tar.gz

.github/workflows/compiler-benchmarks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ on:
3333
required: false
3434
default: ""
3535

36+
concurrency:
37+
group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
38+
cancel-in-progress: true
39+
3640
jobs:
3741

3842
# Benchmarks workflow call from the era-compiler-ci repository
@@ -49,3 +53,5 @@ jobs:
4953
compiler_llvm_candidate_branch: ${{ github.event.inputs.compiler_llvm_candidate_branch || github.head_ref }}
5054
compiler_llvm_benchmark_mode: ${{ github.event.inputs.compiler_llvm_benchmark_mode || '^M^B3' }}
5155
compiler_llvm_benchmark_path: ${{ github.event.inputs.compiler_llvm_benchmark_path || '' }}
56+
ccache-key-type: 'static' # rotate ccache key every month
57+
compiler-llvm-repo: ${{ github.event.pull_request.head.repo.full_name }} # required to properly test forks

.github/workflows/compiler-integration-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Integration tests
22

33
on:
4-
push:
5-
branches:
6-
- main
74
pull_request:
85
workflow_dispatch:
96
inputs:
@@ -16,6 +13,10 @@ on:
1613
required: true
1714
default: "main"
1815

16+
concurrency:
17+
group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18+
cancel-in-progress: true
19+
1920
jobs:
2021

2122
# Check for secrets leak in the repository
@@ -31,4 +32,6 @@ jobs:
3132
secrets: inherit
3233
with:
3334
compiler-tester-ref: ${{ github.event.inputs.compiler_tester_branch || 'main' }}
34-
llvm-ref: ${{ github.event.inputs.compiler_llvm_branch || github.head_ref }}
35+
llvm-ref: ${{ github.event.inputs.compiler_llvm_branch || github.head_ref || github.event.repository.default_branch }}
36+
ccache-key-type: 'static' # rotate ccache key every month
37+
compiler-llvm-repo: ${{ github.event.pull_request.head.repo.full_name }} # required to properly test forks

.github/workflows/regression-tests.yml

Lines changed: 12 additions & 12 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:
@@ -39,6 +39,7 @@ jobs:
3939
with:
4040
ref: ${{ steps.extract_branch.outputs.head_ref }}
4141
fetch-depth: ${{ github.event.pull_request.commits || github.event.inputs.commits-to-test }}
42+
repository: ${{ github.event.pull_request.head.repo.full_name }}
4243

4344
- name: Prepare commits
4445
id: prepare
@@ -65,6 +66,7 @@ jobs:
6566
with:
6667
ref: ${{ matrix.commit }}
6768
fetch-depth: ${{ needs.prepare-test-matrix.outputs.fetch_depth }}
69+
repository: ${{ github.event.pull_request.head.repo.full_name }}
6870

6971
- name: Get changed files
7072
id: changed-files
@@ -80,8 +82,12 @@ jobs:
8082
- name: Run code formatter
8183
run: |
8284
set -x
83-
python3 ./llvm/utils/git/code-format-helper-era-llvm.py \
84-
--token ${{ secrets.GITHUB_TOKEN }} \
85+
if [ '${{ github.event.pull_request.head.repo.fork }}' = 'true' ]; then
86+
TOKEN_PARAM=""
87+
else
88+
TOKEN_PARAM="--token ${{ secrets.GITHUB_TOKEN }}"
89+
fi
90+
python3 ./llvm/utils/git/code-format-helper-era-llvm.py ${TOKEN_PARAM} \
8591
--issue-number ${{ github.event.pull_request.number }} \
8692
--start-rev ${{ github.event.pull_request.base.sha }} \
8793
--end-rev ${{ matrix.commit }} \
@@ -103,12 +109,7 @@ jobs:
103109
with:
104110
ref: ${{ matrix.commit }}
105111
path: "llvm"
106-
107-
# Ccache will be updated each month
108-
# Older caches will be deprecated automatically after 7 days of inactivity
109-
- name: Define ccache key
110-
id: ccache-key
111-
run: echo "key=llvm-${{ github.event.repository.default_branch }}-$(date +'%Y-%m')" | tee -a "${GITHUB_OUTPUT}"
112+
repository: ${{ github.event.pull_request.head.repo.full_name }}
112113

113114
- name: Build LLVM
114115
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1
@@ -117,8 +118,7 @@ jobs:
117118
enable-tests: true
118119
enable-assertions: true
119120
clone-llvm: false
120-
ccache-key: ${{ steps.ccache-key.outputs.key }}
121-
121+
ccache-key-type: 'static' # rotate ccache key every month
122122

123123
# `verify-llvm` is a special target that runs all the regression tests
124124
# it includes `check-llvm` and special codegen tests

llvm/utils/git/code-format-helper-era-llvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def hook_main():
327327

328328
parser = argparse.ArgumentParser()
329329
parser.add_argument(
330-
"--token", type=str, required=True, help="GitHub authentiation token"
330+
"--token", type=str, required=False, help="GitHub authentiation token"
331331
)
332332
parser.add_argument(
333333
"--repo",

0 commit comments

Comments
 (0)