1 # This file defines pre-commit CI for libc++, libc++abi, and libunwind (on Github).
3 # We split the configurations in multiple stages with the intent of saving compute time
4 # 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.
7 # Stages 1 & 2 are meant to be "smoke tests", and are meant to catch most build/test failures quickly and without using
9 # Stage 3 is "everything else", and is meant to catch breakages on more niche or unique configurations.
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-specific
15 name: Build and Test libc++
24 - '.github/workflows/libcxx-build-and-test.yaml'
26 # Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern)
30 contents: read # Default everything to read-only
33 group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
34 cancel-in-progress: true
38 if: github.repository_owner == 'llvm'
39 runs-on: libcxx-self-hosted-linux
40 container: ghcr.io/llvm/libcxx-linux-builder:d8a0709b1090350a7fe3604d8ab78c7d62f10698
41 continue-on-error: false
46 'frozen-cxx03-headers',
54 - config: 'generic-gcc'
58 - uses: actions/checkout@v4
59 - name: ${{ matrix.config }}.${{ matrix.cxx }}
60 run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
63 CXX: ${{ matrix.cxx }}
64 - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
67 name: ${{ matrix.config }}-${{ matrix.cxx }}-results
71 **/CMakeConfigureLog.yaml
74 **/crash_diagnostics/*
76 if: github.repository_owner == 'llvm'
77 runs-on: libcxx-self-hosted-linux
78 container: ghcr.io/llvm/libcxx-linux-builder:d8a0709b1090350a7fe3604d8ab78c7d62f10698
80 continue-on-error: false
94 - config: 'generic-gcc-cxx11'
97 - config: 'generic-cxx23'
100 - config: 'generic-cxx26'
104 - uses: actions/checkout@v4
105 - name: ${{ matrix.config }}
106 run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
109 CXX: ${{ matrix.cxx }}
110 - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
111 if: always() # Upload artifacts even if the build or test suite fails
113 name: ${{ matrix.config }}-${{ matrix.cxx }}-results
117 **/CMakeConfigureLog.yaml
120 **/crash_diagnostics/*
122 if: github.repository_owner == 'llvm'
123 needs: [ stage1, stage2 ]
124 continue-on-error: false
130 'generic-abi-unstable',
131 'generic-hardening-mode-debug',
132 'generic-hardening-mode-extensive',
133 'generic-hardening-mode-fast',
134 'generic-hardening-mode-fast-with-abi-breaks',
136 'generic-modules-lsv',
137 'generic-no-exceptions',
138 'generic-no-experimental',
139 'generic-no-filesystem',
140 'generic-no-localization',
141 'generic-no-terminal',
142 'generic-no-random_device',
143 'generic-no-threads',
145 'generic-no-unicode',
146 'generic-no-wide-characters',
148 'generic-optimized-speed',
150 'bootstrapping-build'
152 machine: [ 'libcxx-self-hosted-linux' ]
154 - config: 'generic-cxx26'
155 machine: libcxx-self-hosted-linux
156 - config: 'generic-asan'
157 machine: libcxx-self-hosted-linux
158 - config: 'generic-tsan'
159 machine: libcxx-self-hosted-linux
160 - config: 'generic-ubsan'
161 machine: libcxx-self-hosted-linux
162 # Use a larger machine for MSAN to avoid timeout and memory allocation issues.
163 - config: 'generic-msan'
164 machine: libcxx-self-hosted-linux
165 runs-on: ${{ matrix.machine }}
166 container: ghcr.io/llvm/libcxx-linux-builder:d8a0709b1090350a7fe3604d8ab78c7d62f10698
168 - uses: actions/checkout@v4
169 - name: ${{ matrix.config }}
170 run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
174 - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
177 name: ${{ matrix.config }}-results
181 **/CMakeConfigureLog.yaml
184 **/crash_diagnostics/*
192 - config: generic-cxx03
194 - config: generic-cxx23
196 - config: generic-modules
198 - config: apple-configuration
200 - config: apple-system
202 - config: apple-system-hardened
204 runs-on: ${{ matrix.os }}
206 - uses: actions/checkout@v4
207 - uses: maxim-lobanov/setup-xcode@v1
209 xcode-version: 'latest'
210 - uses: seanmiddleditch/gha-setup-ninja@master
211 - name: Build and test
213 python3 -m venv .venv
214 source .venv/bin/activate
215 python -m pip install psutil
216 bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
217 - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
218 if: always() # Upload artifacts even if the build or test suite fails
220 name: macos-${{ matrix.config }}-results
224 **/CMakeConfigureLog.yaml
227 **/crash_diagnostics/*
230 runs-on: windows-2022
236 - { config: clang-cl-dll, mingw: false }
237 - { config: clang-cl-static, mingw: false }
238 - { config: clang-cl-no-vcruntime, mingw: false }
239 - { config: clang-cl-debug, mingw: false }
240 - { config: clang-cl-static-crt, mingw: false }
241 - { config: mingw-dll, mingw: true }
242 - { config: mingw-static, mingw: true }
243 - { config: mingw-dll-i686, mingw: true }
244 - { config: mingw-incomplete-sysroot, mingw: true }
246 - uses: actions/checkout@v4
247 - name: Install dependencies
249 choco install -y ninja
251 - name: Install a current LLVM
252 if: ${{ matrix.mingw != true }}
254 choco install -y llvm --version=18.1.6 --allow-downgrade
255 - name: Install llvm-mingw
256 if: ${{ matrix.mingw == true }}
258 curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20240606/llvm-mingw-20240606-ucrt-x86_64.zip
259 powershell Expand-Archive llvm-mingw*.zip -DestinationPath .
261 mv llvm-mingw* c:\llvm-mingw
262 echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
263 - name: Simulate a from-scratch build of llvm-mingw
264 if: ${{ matrix.config == 'mingw-incomplete-sysroot' }}
266 rm -r c:\llvm-mingw\include\c++
267 rm -r c:\llvm-mingw\*-w64-mingw32\lib\libc++*
268 rm -r c:\llvm-mingw\*-w64-mingw32\lib\libunwind*
269 - name: Add Git Bash to the path
271 echo "c:\Program Files\Git\usr\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
272 - name: Set up the MSVC dev environment
273 if: ${{ matrix.mingw != true }}
274 uses: ilammy/msvc-dev-cmd@v1
275 - name: Build and test
277 bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}