Skip to content

Commit 8ea4c39

Browse files
committed
[workflows] Rework pre-commit CI for the release branch
This rewrites the pre-commit CI for the release branch so that it behaves almost exactly like the current buildkite builders. It builds every project and uses a better filtering method for selecting which projects to build. In addition, with this change we drop the Linux and Windows test configs, since these are already covered by buildkite and add a config for macos/aarch64.
1 parent 617a15a commit 8ea4c39

File tree

11 files changed

+783
-38
lines changed

11 files changed

+783
-38
lines changed

.github/workflows/ci-tests.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: "CI Tests"
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
# When a PR is closed, we still start this workflow, but then skip
13+
# all the jobs, which makes it effectively a no-op. The reason to
14+
# do this is that it allows us to take advantage of concurrency groups
15+
# to cancel in progress CI jobs whenever the PR is closed.
16+
- closed
17+
branches:
18+
- 'release/**'
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
22+
cancel-in-progress: True
23+
24+
jobs:
25+
compute-test-configs:
26+
name: "Compute Configurations to Test"
27+
if: >-
28+
github.repository_owner == 'llvm' &&
29+
github.event.action != 'closed'
30+
runs-on: ubuntu-22.04
31+
outputs:
32+
projects: ${{ steps.vars.outputs.projects }}
33+
check-targets: ${{ steps.vars.outputs.check-targets }}
34+
test-build: ${{ steps.vars.outputs.check-targets != '' }}
35+
test-platforms: ${{ steps.platforms.outputs.result }}
36+
steps:
37+
- name: Fetch LLVM sources
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 2
41+
42+
- name: Compute projects to test
43+
id: vars
44+
uses: ./.github/workflows/compute-projects-to-test
45+
46+
- name: Compute platforms to test
47+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
48+
id: platforms
49+
with:
50+
script: |
51+
linuxConfig = {
52+
name: "linux-x86_64",
53+
runs_on: "ubuntu-22.04"
54+
}
55+
windowsConfig = {
56+
name: "windows-x86_64",
57+
runs_on: "windows-2022"
58+
}
59+
macConfig = {
60+
name: "macos-x86_64",
61+
runs_on: "macos-13"
62+
}
63+
macArmConfig = {
64+
name: "macos-aarch64",
65+
runs_on: "macos-14"
66+
}
67+
68+
configs = []
69+
70+
const base_ref = process.env.GITHUB_BASE_REF;
71+
if (base_ref.startsWith('release/')) {
72+
// This is a pull request against a release branch.
73+
configs.push(macConfig)
74+
configs.push(macArmConfig)
75+
}
76+
77+
return configs;
78+
79+
ci-build-test:
80+
# If this job name is changed, then we need to update the job-name
81+
# paramater for the timeout-save step below.
82+
name: "Build"
83+
needs:
84+
- compute-test-configs
85+
permissions:
86+
actions: write #pr-sccache-save may delete artifacts.
87+
runs-on: ${{ matrix.runs_on }}
88+
strategy:
89+
fail-fast: false
90+
matrix:
91+
include: ${{ fromJson(needs.compute-test-configs.outputs.test-platforms) }}
92+
if: needs.compute-test-configs.outputs.test-build == 'true'
93+
steps:
94+
- name: Fetch LLVM sources
95+
uses: actions/checkout@v4
96+
97+
- name: Timeout Restore
98+
id: timeout
99+
uses: ./.github/workflows/timeout-restore
100+
with:
101+
artifact-name-suffix: ${{ matrix.name }}
102+
103+
- name: Setup Windows
104+
uses: llvm/actions/setup-windows@main
105+
if: ${{ runner.os == 'Windows' }}
106+
with:
107+
arch: amd64
108+
109+
- name: Install Ninja
110+
uses: llvm/actions/install-ninja@main
111+
112+
- name: Setup sccache
113+
uses: hendrikmuhs/ccache-action@v1
114+
with:
115+
max-size: 2G
116+
variant: sccache
117+
key: ci-${{ matrix.name }}
118+
119+
- name: Restore sccache from previous PR run
120+
uses: ./.github/workflows/pr-sccache-restore
121+
with:
122+
artifact-name-suffix: ${{ matrix.name }}
123+
124+
- name: Configure
125+
if: ${{ steps.timeout.outputs.exists != 'true' }}
126+
shell: bash
127+
run: |
128+
cmake -B build -GNinja \
129+
-DCMAKE_BUILD_TYPE=Release \
130+
-DLLVM_ENABLE_PROJECTS="${{ needs.compute-test-configs.outputs.projects }}" \
131+
-DLLVM_ENABLE_ASSERTIONS=ON \
132+
-DLLVM_LIT_ARGS="-v --no-progress-bar" \
133+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
134+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
135+
-S llvm
136+
137+
- name: Build
138+
shell: bash
139+
timeout-minutes: 330
140+
run: |
141+
ninja -C build -k 0 ${{ needs.compute-test-configs.outputs.check-targets }}
142+
143+
- name: Timeout Save
144+
if: always()
145+
uses: ./.github/workflows/timeout-save
146+
with:
147+
job-name: "Build (${{ matrix.name }}, ${{ matrix.runs_on }})"
148+
artifact-name-suffix: ${{ matrix.name }}
149+
timeout-step: "Build"
150+
timeout-minutes: 330
151+
152+
- name: Save sccache for next PR run
153+
if: always()
154+
uses: ./.github/workflows/pr-sccache-save
155+
with:
156+
artifact-name-suffix: ${{ matrix.name }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Compute Projects To Test'
2+
inputs:
3+
projects:
4+
required: false
5+
type: 'string'
6+
7+
outputs:
8+
check-targets:
9+
description: "A space delimited list of check-targets to pass to ninja."
10+
value: ${{ steps.compute-projects.outputs.check-targets }}
11+
12+
projects:
13+
description: "A semi-colon delimited list of projects to pass to -DLLVM_ENABLE_PROJECTS."
14+
value: ${{ steps.compute-projects.outputs.projects }}
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
- id: compute-projects
20+
run: .github/workflows/compute-projects-to-test/compute-projects-to-test.sh ${{ inputs.projects }}
21+
shell: bash

0 commit comments

Comments
 (0)