291 lines · yaml
1# This file defines pre-commit CI for libc++, libc++abi, and libunwind (on Github).2#3# We split the configurations in multiple stages with the intent of saving compute time4# when a job fails early in the pipeline. This is why the jobs are marked as `continue-on-error: false`.5# We try to run the CI configurations with the most signal in the first stage.6#7# Stages 1 & 2 are meant to be "smoke tests", and are meant to catch most build/test failures quickly and without using8# too many resources.9# Stage 3 is "everything else", and is meant to catch breakages on more niche or unique configurations.10#11# Therefore, we "fail-fast" for any failures during stages 1 & 2, meaning any job failing cancels all other running jobs,12# under the assumption that if the "smoke tests" fail, then the other configurations will likely fail in the same way.13# However, stage 3 does not fail fast, as it's more likely that any one job failing is a flake or a configuration-specific14#15name: Build and Test libc++16on:17 pull_request:18 paths:19 - 'libcxx/**'20 - 'libcxxabi/**'21 - 'libunwind/**'22 - 'runtimes/**'23 - 'cmake/**'24 - '.github/workflows/libcxx-build-and-test.yaml'25 schedule:26 # Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern)27 - cron: '0 8 * * *'28 29permissions:30 contents: read # Default everything to read-only31 32concurrency:33 group: ${{ github.workflow }}-${{ github.event.pull_request.number }}34 cancel-in-progress: true35 36jobs:37 stage1:38 if: github.repository_owner == 'llvm'39 runs-on: llvm-premerge-libcxx-runners40 continue-on-error: false41 strategy:42 fail-fast: false43 matrix:44 config: [45 'frozen-cxx03-headers',46 'generic-cxx03',47 'generic-cxx26',48 'generic-modules'49 ]50 cc: [ 'clang-22' ]51 cxx: [ 'clang++-22' ]52 include:53 - config: 'generic-gcc'54 cc: 'gcc-15'55 cxx: 'g++-15'56 steps:57 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.058 - name: ${{ matrix.config }}.${{ matrix.cxx }}59 run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}60 env:61 CC: ${{ matrix.cc }}62 CXX: ${{ matrix.cxx }}63 - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.064 if: always()65 with:66 name: ${{ matrix.config }}-${{ matrix.cxx }}-results67 path: |68 **/test-results.xml69 **/*.abilist70 **/CMakeConfigureLog.yaml71 **/CMakeError.log72 **/CMakeOutput.log73 **/crash_diagnostics/*74 stage2:75 if: github.repository_owner == 'llvm'76 runs-on: llvm-premerge-libcxx-runners77 needs: [ stage1 ]78 continue-on-error: false79 strategy:80 fail-fast: false81 matrix:82 config: [83 'generic-cxx11',84 'generic-cxx14',85 'generic-cxx17',86 'generic-cxx20',87 'generic-cxx23'88 ]89 cc: [ 'clang-22' ]90 cxx: [ 'clang++-22' ]91 include:92 - config: 'generic-gcc-cxx11'93 cc: 'gcc-15'94 cxx: 'g++-15'95 - config: 'generic-cxx26'96 cc: 'clang-21'97 cxx: 'clang++-21'98 - config: 'generic-cxx26'99 cc: 'clang-20'100 cxx: 'clang++-20'101 steps:102 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0103 - name: ${{ matrix.config }}104 run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}105 env:106 CC: ${{ matrix.cc }}107 CXX: ${{ matrix.cxx }}108 - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0109 if: always() # Upload artifacts even if the build or test suite fails110 with:111 name: ${{ matrix.config }}-${{ matrix.cxx }}-results112 path: |113 **/test-results.xml114 **/*.abilist115 **/CMakeConfigureLog.yaml116 **/CMakeError.log117 **/CMakeOutput.log118 **/crash_diagnostics/*119 stage3:120 if: github.repository_owner == 'llvm'121 needs: [ stage2 ]122 continue-on-error: false123 strategy:124 fail-fast: false125 max-parallel: 8126 matrix:127 config: [128 'generic-abi-unstable',129 'generic-hardening-mode-debug',130 'generic-hardening-mode-extensive',131 'generic-hardening-mode-extensive-observe-semantic',132 'generic-hardening-mode-fast',133 'generic-hardening-mode-fast-with-abi-breaks',134 'generic-merged',135 'generic-modules-cxx17-lsv',136 'generic-no-exceptions',137 'generic-no-experimental',138 'generic-no-filesystem',139 'generic-no-localization',140 'generic-no-terminal',141 'generic-no-random_device',142 'generic-no-threads',143 'generic-no-tzdb',144 'generic-no-unicode',145 'generic-no-wide-characters',146 'generic-no-rtti',147 'generic-optimized-speed',148 'generic-static',149 'bootstrapping-build'150 ]151 machine: [ 'llvm-premerge-libcxx-runners' ]152 include:153 - config: 'generic-cxx26'154 machine: llvm-premerge-libcxx-runners155 - config: 'generic-asan'156 machine: llvm-premerge-libcxx-runners157 - config: 'generic-tsan'158 machine: llvm-premerge-libcxx-runners159 - config: 'generic-ubsan'160 machine: llvm-premerge-libcxx-runners161 # Use a larger machine for MSAN to avoid timeout and memory allocation issues.162 - config: 'generic-msan'163 machine: llvm-premerge-libcxx-runners164 runs-on: ${{ matrix.machine }}165 steps:166 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0167 - name: ${{ matrix.config }}168 run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}169 env:170 CC: clang-22171 CXX: clang++-22172 - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0173 if: always()174 with:175 name: ${{ matrix.config }}-results176 path: |177 **/test-results.xml178 **/*.abilist179 **/CMakeConfigureLog.yaml180 **/CMakeError.log181 **/CMakeOutput.log182 **/crash_diagnostics/*183 184 macos:185 needs: [ stage2 ]186 strategy:187 fail-fast: false188 matrix:189 include:190 - config: generic-cxx03191 os: macos-15192 - config: generic-cxx23193 os: macos-15194 - config: generic-modules195 os: macos-15196 - config: apple-configuration197 os: macos-15198 # TODO: These jobs are intended to test back-deployment (building against ToT libc++ but running against an199 # older system-provided libc++.dylib). Doing this properly would require building the test suite on a200 # recent macOS using a recent Clang (hence recent Xcode), and then running the actual test suite on an201 # older mac. We could do that by e.g. sharing artifacts between the two jobs.202 #203 # However, our Lit configuration currently doesn't provide a good way to do that in a batch, so our only204 # alternative is to actually build on the same host that we're going to run on. Sadly, that doesn't work205 # since older macOSes don't support newer Xcodes. For now, we run the "backdeployment" jobs on recent206 # macOS versions as a way to avoid rotting that configuration, but it doesn't provide a lot of additional207 # coverage.208 - config: apple-system209 os: macos-15210 - config: apple-system-hardened211 os: macos-15212 runs-on: ${{ matrix.os }}213 steps:214 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0215 - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0216 with:217 # https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md218 xcode-version: '26.0'219 - uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6220 - name: Build and test221 run: |222 python3 -m venv .venv223 source .venv/bin/activate224 python -m pip install psutil225 xcrun bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}226 - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0227 if: always() # Upload artifacts even if the build or test suite fails228 with:229 name: macos-${{ matrix.config }}-results230 path: |231 **/test-results.xml232 **/*.abilist233 **/CMakeConfigureLog.yaml234 **/CMakeError.log235 **/CMakeOutput.log236 **/crash_diagnostics/*237 238 windows:239 needs: [ stage2 ]240 strategy:241 fail-fast: false242 matrix:243 include:244 - { config: clang-cl-dll, mingw: false }245 - { config: clang-cl-static, mingw: false }246 - { config: clang-cl-no-vcruntime, mingw: false }247 - { config: clang-cl-debug, mingw: false }248 - { config: clang-cl-static-crt, mingw: false }249 - { config: mingw-dll, mingw: true }250 - { config: mingw-static, mingw: true }251 - { config: mingw-dll-i686, mingw: true }252 - { config: mingw-incomplete-sysroot, mingw: true }253 - { config: mingw-static, mingw: true, runner: windows-11-arm }254 runs-on: ${{ matrix.runner != '' && matrix.runner || 'windows-2022' }}255 steps:256 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0257 - name: Install dependencies258 run: |259 pip install psutil260 - name: Install a current LLVM261 if: ${{ matrix.mingw != true }}262 run: |263 choco install -y llvm --version=20.1.8 --allow-downgrade264 - name: Install llvm-mingw265 if: ${{ matrix.mingw == true }}266 run: |267 curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20250709/llvm-mingw-20250709-ucrt-${{ matrix.runner == 'windows-11-arm' && 'aarch64' || 'x86_64' }}.zip268 powershell Expand-Archive llvm-mingw*.zip -DestinationPath .269 del llvm-mingw*.zip270 mv llvm-mingw* c:\llvm-mingw271 echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append272 - name: Simulate a from-scratch build of llvm-mingw273 if: ${{ matrix.config == 'mingw-incomplete-sysroot' }}274 run: |275 rm -r c:\llvm-mingw\include\c++276 rm -r c:\llvm-mingw\*-w64-mingw32\lib\libc++*277 rm -r c:\llvm-mingw\*-w64-mingw32\lib\libunwind*278 - name: Add Git Bash to the path279 run: |280 echo "c:\Program Files\Git\usr\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append281 - name: Set up the MSVC dev environment282 if: ${{ matrix.mingw != true }}283 uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0284 - name: Add the installed Clang at the start of the path285 if: ${{ matrix.mingw != true }}286 run: |287 echo "c:\Program Files\LLVM\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append288 - name: Build and test289 run: |290 bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}291