Skip to content

Commit 3d1c25e

Browse files
committed
[rust] Add CI Checks to Rust fork
- On Linux, run `check-llvm` and `check-lld`. - On macOS, run `check-llvm`.
1 parent d3c793b commit 3d1c25e

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/rust-premerge.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: CI Checks (Rust fork)
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+
push:
18+
branches:
19+
- 'rustc/**'
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
premerge-checks-linux:
27+
name: Build and Test Linux
28+
if: >-
29+
github.repository_owner == 'rust-lang' &&
30+
(github.event_name != 'pull_request' || github.event.action != 'closed')
31+
runs-on: ubuntu-24.04
32+
steps:
33+
- name: Checkout LLVM
34+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
with:
36+
fetch-depth: 1
37+
- name: Free up disk space
38+
run: |
39+
curl -sSL https://raw.githubusercontent.com/rust-lang/rust/474466dc16f890083af1cdebad0aebf4d4ba88d7/src/ci/scripts/free-disk-space.sh | bash
40+
- name: Install clang-18
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y clang-18 cmake ninja-build
44+
- name: Setup ccache
45+
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
46+
with:
47+
max-size: "2000M"
48+
- name: Build and Test
49+
run: |
50+
projects_to_build='llvm;lld'
51+
project_check_targets='check-llvm check-lld'
52+
runtimes_to_build=''
53+
runtimes_check_targets=''
54+
runtimes_check_targets_needs_reconfig=''
55+
56+
echo "Building projects: ${projects_to_build}"
57+
echo "Running project checks targets: ${project_check_targets}"
58+
echo "Building runtimes: ${runtimes_to_build}"
59+
echo "Running runtimes checks targets: ${runtimes_check_targets}"
60+
echo "Running runtimes checks requiring reconfiguring targets: ${runtimes_check_targets_needs_reconfig}"
61+
62+
export CC=/usr/bin/clang-18
63+
export CXX=/usr/bin/clang++-18
64+
65+
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
66+
67+
premerge-check-macos:
68+
name: Build and Test macOS
69+
runs-on: macos-14
70+
if: >-
71+
github.repository_owner == 'rust-lang' &&
72+
(github.event_name != 'pull_request' || github.event.action != 'closed')
73+
steps:
74+
- name: Checkout LLVM
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
with:
77+
fetch-depth: 1
78+
- name: Setup ccache
79+
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
80+
with:
81+
max-size: "2000M"
82+
- name: Build and Test
83+
run: |
84+
projects_to_build='llvm'
85+
project_check_targets='check-llvm'
86+
87+
echo "Building projects: ${projects_to_build}"
88+
echo "Running project checks targets: ${project_check_targets}"
89+
90+
# -DLLVM_DISABLE_ASSEMBLY_FILES=ON is for
91+
# https://github.com/llvm/llvm-project/issues/81967
92+
# Disable sharding in lit so that the LIT_XFAIL environment var works.
93+
cmake -G Ninja \
94+
-B build \
95+
-S llvm \
96+
-DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
97+
-DLLVM_DISABLE_ASSEMBLY_FILES=ON \
98+
-DCMAKE_BUILD_TYPE=Release \
99+
-DLLDB_INCLUDE_TESTS=OFF \
100+
-DLLVM_ENABLE_ASSERTIONS=ON \
101+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
102+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
103+
104+
# The libcxx tests fail, so we are skipping the runtime targets.
105+
ninja -C build ${project_check_targets}

0 commit comments

Comments
 (0)