Clang #187
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clang | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
std_version: [20, 23] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Add homebrew to PATH (Linux only) | |
if: runner.os == 'Linux' | |
run: | | |
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH | |
- name: Get LLVM and Ninja via Homebrew | |
run: | | |
brew install llvm ninja | |
echo "CC=$(brew --prefix llvm)/bin/clang" >> "$GITHUB_ENV" | |
echo "CXX=$(brew --prefix llvm)/bin/clang++" >> "$GITHUB_ENV" | |
- name: Cache libc++ build | |
id: cache-libcxx | |
uses: actions/cache@v4 | |
with: | |
path: llvm-project/build | |
key: ${{ runner.os }}-libcxx | |
- name: Make local build of libc++ with Standard Library Module (when cache miss) | |
if: steps.cache-libcxx.outputs.cache-hit != 'true' | |
run: | | |
git clone https://github.com/llvm/llvm-project.git | |
cd llvm-project | |
mkdir build | |
cmake -G Ninja -S runtimes -B build \ | |
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ | |
-DLLVM_INCLUDE_TESTS=OFF | |
ninja -C build | |
- name: Configure | |
run: | | |
mkdir build | |
cmake -S . -G Ninja -B build \ | |
-DCMAKE_CXX_STANDARD=${{ matrix.std_version }} \ | |
-DLIBCXX_BUILD=${{ github.workspace }}/llvm-project/build | |
- name: Build | |
run: | | |
cmake --build build -t CppStandardLibraryModule --config Release | |
- name: Run executable | |
run: | | |
./build/CppStandardLibraryModule |