[libc] add multi-platform pre-commit github actions #16
Workflow file for this run
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
# This workflow is for pre-commit testing of the LLVM-libc project. | |
name: LLVM-libc Pre-commit Overlay Tests | |
on: | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'libc/**' | |
- '.github/workflows/libc-overlay-tests.yml' | |
jobs: | |
build: | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. | |
fail-fast: false | |
matrix: | |
include: | |
# TODO: add linux gcc when it is fixed | |
- os: ubuntu-24.04 | |
compiler: | |
c_compiler: clang | |
cpp_compiler: clang++ | |
cmake_config: | |
- os: windows-latest | |
compiler: | |
c_compiler: clang-cl | |
cpp_compiler: clang-cl | |
cmake_config: -TClangCL | |
- os: macos-14 | |
compiler: | |
c_compiler: clang | |
cpp_compiler: clang++ | |
cmake_config: | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Prepare dependencies (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }} | |
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }} | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo | |
-DCMAKE_C_COMPILER_LAUNCHER=sccache | |
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache | |
-DLLVM_ENABLE_RUNTIMES=libc | |
${{ matrix.cmake_config }} | |
-S ${{ github.workspace }}/runtimes | |
- name: Build | |
run: > | |
cmake | |
--build ${{ steps.strings.outputs.build-output-dir }} | |
--parallel | |
--config RelWithDebInfo | |
--target libc | |
- name: Test | |
run: > | |
cmake | |
--build ${{ steps.strings.outputs.build-output-dir }} | |
--parallel | |
--target check-libc |