237 lines · yaml
1name: CI Checks2 3permissions:4 contents: read5 6on:7 pull_request:8 types:9 - opened10 - synchronize11 - reopened12 # When a PR is closed, we still start this workflow, but then skip13 # all the jobs, which makes it effectively a no-op. The reason to14 # do this is that it allows us to take advantage of concurrency groups15 # to cancel in progress CI jobs whenever the PR is closed.16 - closed17 push:18 branches:19 - 'release/**'20 21concurrency:22 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}23 cancel-in-progress: true24 25jobs:26 premerge-checks-linux:27 name: Build and Test Linux${{ (startsWith(matrix.runs-on, 'depot-ubuntu-24.04-arm') && ' AArch64') || '' }}28 if: >-29 github.repository_owner == 'llvm' &&30 (github.event_name != 'pull_request' || github.event.action != 'closed')31 strategy:32 fail-fast: false33 matrix:34 runs-on:35 - depot-ubuntu-24.04-arm-1636 - llvm-premerge-linux-runners37 runs-on: ${{ matrix.runs-on }}38 container:39 # The llvm-premerge agents are already containers and running the40 # this same image, so we can't use a container for the github action41 # job. The depot containers are running on VMs, so we can use a42 # container. This helps ensure the build environment is as close43 # as possible on both the depot runners and the llvm-premerge runners.44 image: ${{ (startsWith(matrix.runs-on, 'depot-ubuntu-24.04-arm') && format('ghcr.io/{0}/arm64v8/ci-ubuntu-24.04',github.repository_owner) ) || null }}45 # --privileged is needed to run the lldb tests that disable aslr.46 # The SCCACHE environment variables are need to be copied from the host47 # to the container to make sure it is configured correctly to use the48 # depot cache.49 options: >-50 --privileged51 --env SCCACHE_WEBDAV_ENDPOINT52 --env SCCACHE_WEBDAV_TOKEN53 defaults:54 run:55 # The run step defaults to using sh as the shell when running in a56 # container, so make bash the default to ensure consistency between57 # container and non-container jobs.58 shell: bash59 steps:60 - name: Checkout LLVM61 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.062 with:63 fetch-depth: 264 - name: Build and Test65 timeout-minutes: 12066 continue-on-error: ${{ runner.arch == 'ARM64' }}67 env:68 GITHUB_TOKEN: ${{ github.token }}69 GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}70 run: |71 git config --global --add safe.directory '*'72 73 source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)74 75 if [[ "${projects_to_build}" == "" ]]; then76 echo "No projects to build"77 exit 078 fi79 80 echo "Building projects: ${projects_to_build}"81 echo "Running project checks targets: ${project_check_targets}"82 echo "Building runtimes: ${runtimes_to_build}"83 echo "Running runtimes checks targets: ${runtimes_check_targets}"84 echo "Running runtimes checks requiring reconfiguring targets: ${runtimes_check_targets_needs_reconfig}"85 86 export CC=/opt/llvm/bin/clang87 export CXX=/opt/llvm/bin/clang++88 89 # The linux-premerge runners are hosted on GCP and have a different90 # cache setup than the depot runners.91 if [[ "${{ matrix.runs-on }}" = "llvm-premerge-linux-runners" ]]; then92 # This environment variable is passes into the container through the93 # runner pod definition. This differs between our two clusters which94 # why we do not hardcode it.95 export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET96 export SCCACHE_GCS_RW_MODE=READ_WRITE97 fi98 env99 100 # Set the idle timeout to zero to ensure sccache runs for the101 # entire duration of the job. Otherwise it might stop if we run102 # several test suites in a row and discard statistics that we want103 # to save in the end.104 export SCCACHE_IDLE_TIMEOUT=0105 mkdir artifacts106 SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server107 108 ./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"109 - name: Upload Artifacts110 # In some cases, Github will fail to upload the artifact. We want to111 # continue anyways as a failed artifact upload is an infra failure, not112 # a checks failure.113 # https://github.com/actions/upload-artifact/issues/569114 continue-on-error: true115 if: '!cancelled()'116 uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0117 with:118 name: Premerge Artifacts (Linux ${{ runner.arch }})119 path: artifacts/120 retention-days: 5121 include-hidden-files: 'true'122 - name: Upload Comment123 uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0124 if: ${{ always() && !startsWith(matrix.runs-on, 'depot-ubuntu-24.04-arm') }}125 continue-on-error: true126 with:127 name: workflow-args128 path: |129 comments130 131 premerge-checks-windows:132 name: Build and Test Windows133 if: >-134 github.repository_owner == 'llvm' &&135 (github.event_name != 'pull_request' || github.event.action != 'closed')136 runs-on: llvm-premerge-windows-2022-runners137 defaults:138 run:139 shell: bash140 steps:141 - name: Checkout LLVM142 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0143 with:144 fetch-depth: 2145 - name: Compute Projects146 id: vars147 run: |148 source <(git diff --name-only HEAD~1...HEAD | python .ci/compute_projects.py)149 150 if [[ "${projects_to_build}" == "" ]]; then151 echo "No projects to build"152 fi153 154 echo "Building projects: ${projects_to_build}"155 echo "Running project checks targets: ${project_check_targets}"156 echo "Building runtimes: ${runtimes_to_build}"157 echo "Running runtimes checks targets: ${runtimes_check_targets}"158 159 echo "windows-projects=${projects_to_build}" >> $GITHUB_OUTPUT160 echo "windows-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT161 echo "windows-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT162 echo "windows-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT163 - name: Build and Test164 timeout-minutes: 180165 if: ${{ steps.vars.outputs.windows-projects != '' }}166 shell: cmd167 env:168 GITHUB_TOKEN: ${{ github.token }}169 GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}170 run: |171 call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64172 # See the comments above in the Linux job for why we define each of173 # these environment variables.174 bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; mkdir artifacts; SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\" \"${{ steps.vars.outputs.windows-runtimes }}\" \"${{ steps.vars.outputs.windows-runtimes-check-targets }}\""175 - name: Upload Artifacts176 # In some cases, Github will fail to upload the artifact. We want to177 # continue anyways as a failed artifact upload is an infra failure, not178 # a checks failure.179 # https://github.com/actions/upload-artifact/issues/569180 continue-on-error: true181 if: '!cancelled()'182 uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0183 with:184 name: Premerge Artifacts (Windows)185 path: artifacts/186 retention-days: 5187 include-hidden-files: 'true'188 189 premerge-check-macos:190 name: MacOS Premerge Checks191 runs-on: macos-14192 if: >-193 github.repository_owner == 'llvm' &&194 (startswith(github.ref_name, 'release/') ||195 startswith(github.base_ref, 'release/')) &&196 (github.event_name != 'pull_request' || github.event.action != 'closed')197 steps:198 - name: Checkout LLVM199 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0200 with:201 fetch-depth: 2202 - name: Setup ccache203 uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20204 with:205 max-size: "2000M"206 - name: Install Ninja207 run: |208 brew install ninja209 - name: Build and Test210 run: |211 source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)212 213 if [[ "${projects_to_build}" == "" ]]; then214 echo "No projects to build"215 exit 0216 fi217 218 echo "Building projects: ${projects_to_build}"219 echo "Running project checks targets: ${project_check_targets}"220 221 # -DLLVM_DISABLE_ASSEMBLY_FILES=ON is for222 # https://github.com/llvm/llvm-project/issues/81967223 # Disable sharding in lit so that the LIT_XFAIL environment var works.224 cmake -G Ninja \225 -B build \226 -S llvm \227 -DLLVM_ENABLE_PROJECTS="${projects_to_build}" \228 -DLLVM_DISABLE_ASSEMBLY_FILES=ON \229 -DCMAKE_BUILD_TYPE=Release \230 -DLLDB_INCLUDE_TESTS=OFF \231 -DLLVM_ENABLE_ASSERTIONS=ON \232 -DCMAKE_C_COMPILER_LAUNCHER=ccache \233 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache234 235 # The libcxx tests fail, so we are skipping the runtime targets.236 ninja -C build ${project_check_targets}237