[rust] Add CI Checks to Rust fork
- On Linux, run `check-llvm` and `check-lld`.
- On macOS, run `check-llvm`.
diff --git a/.github/workflows/rust-premerge.yaml b/.github/workflows/rust-premerge.yaml
new file mode 100644
index 0000000..8c34ba1
--- /dev/null
+++ b/.github/workflows/rust-premerge.yaml
@@ -0,0 +1,105 @@
+name: CI Checks (Rust fork)
+
+permissions:
+ contents: read
+
+on:
+ pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
+ # When a PR is closed, we still start this workflow, but then skip
+ # all the jobs, which makes it effectively a no-op. The reason to
+ # do this is that it allows us to take advantage of concurrency groups
+ # to cancel in progress CI jobs whenever the PR is closed.
+ - closed
+ push:
+ branches:
+ - 'rustc/**'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+ cancel-in-progress: true
+
+jobs:
+ premerge-checks-linux:
+ name: Build and Test Linux
+ if: >-
+ github.repository_owner == 'rust-lang' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout LLVM
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ fetch-depth: 1
+ - name: Free up disk space
+ run: |
+ curl -sSL https://raw.githubusercontent.com/rust-lang/rust/474466dc16f890083af1cdebad0aebf4d4ba88d7/src/ci/scripts/free-disk-space.sh | bash
+ - name: Install clang-18
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y clang-18 cmake ninja-build
+ - name: Setup ccache
+ uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
+ with:
+ max-size: "2000M"
+ - name: Build and Test
+ run: |
+ projects_to_build='llvm;lld'
+ project_check_targets='check-llvm check-lld'
+ runtimes_to_build=''
+ runtimes_check_targets=''
+ runtimes_check_targets_needs_reconfig=''
+
+ echo "Building projects: ${projects_to_build}"
+ echo "Running project checks targets: ${project_check_targets}"
+ echo "Building runtimes: ${runtimes_to_build}"
+ echo "Running runtimes checks targets: ${runtimes_check_targets}"
+ echo "Running runtimes checks requiring reconfiguring targets: ${runtimes_check_targets_needs_reconfig}"
+
+ export CC=/usr/bin/clang-18
+ export CXX=/usr/bin/clang++-18
+
+ ./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
+
+ premerge-check-macos:
+ name: Build and Test macOS
+ runs-on: macos-14
+ if: >-
+ github.repository_owner == 'rust-lang' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
+ steps:
+ - name: Checkout LLVM
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ fetch-depth: 1
+ - name: Setup ccache
+ uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
+ with:
+ max-size: "2000M"
+ - name: Build and Test
+ run: |
+ projects_to_build='llvm'
+ project_check_targets='check-llvm'
+
+ echo "Building projects: ${projects_to_build}"
+ echo "Running project checks targets: ${project_check_targets}"
+
+ # -DLLVM_DISABLE_ASSEMBLY_FILES=ON is for
+ # https://github.com/llvm/llvm-project/issues/81967
+ # Disable sharding in lit so that the LIT_XFAIL environment var works.
+ cmake -G Ninja \
+ -B build \
+ -S llvm \
+ -DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
+ -DLLVM_DISABLE_ASSEMBLY_FILES=ON \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLDB_INCLUDE_TESTS=OFF \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
+
+ # The libcxx tests fail, so we are skipping the runtime targets.
+ ninja -C build ${project_check_targets}