115 lines · yaml
1# This workflow is for pre-commit testing of the LLVM-libc project.2name: LLVM-libc Pre-commit Overlay Tests3permissions:4 contents: read5on:6 pull_request:7 branches: [ "main" ]8 paths:9 - 'libc/**'10 - '.github/workflows/libc-overlay-tests.yml'11 12jobs:13 build:14 runs-on: ${{ matrix.os }}15 strategy:16 # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.17 fail-fast: false18 matrix:19 os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2022, windows-2025, macos-14]20 include:21 # TODO: add linux gcc when it is fixed22 - os: ubuntu-24.0423 compiler:24 c_compiler: clang25 cpp_compiler: clang++26 - os: ubuntu-24.04-arm27 compiler:28 c_compiler: clang29 cpp_compiler: clang++30 - os: windows-202231 compiler:32 c_compiler: clang-cl33 cpp_compiler: clang-cl34 - os: windows-202535 compiler:36 c_compiler: clang-cl37 cpp_compiler: clang-cl38 - os: macos-1439 compiler:40 c_compiler: clang41 cpp_compiler: clang++42 43 steps:44 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.045 46 # Libc's build is relatively small comparing with other components of LLVM.47 # A fresh linux overlay takes about 180MiB of uncompressed disk space, which can48 # be compressed into ~40MiB. MacOS and Windows overlay builds are less than 10MiB49 # after compression. Limiting the cache size to 1G should be enough.50 # Prefer sccache as it is modern and it has a guarantee to work with MSVC.51 # Do not use direct GHAC access even though it is supported by sccache. GHAC rejects52 # frequent small object writes.53 - name: Setup ccache54 uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.2055 with:56 max-size: 1G57 key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}58 variant: sccache59 60 # MPFR is required by some of the mathlib tests.61 - name: Prepare dependencies (Ubuntu)62 if: runner.os == 'Linux'63 run: |64 sudo apt-get update65 sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build66 67 # Chocolatey is shipped with Windows runners. Windows Server 2025 recommends WinGet.68 # Consider migrating to WinGet when Windows Server 2025 is available.69 - name: Prepare dependencies (Windows)70 if: runner.os == 'Windows'71 run: |72 choco install ninja73 74 - name: Prepare dependencies (macOS)75 if: runner.os == 'macOS'76 run: |77 brew install ninja78 79 - name: Set reusable strings80 id: strings81 shell: bash82 run: |83 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"84 85 # Use MinSizeRel to reduce the size of the build.86 # Notice that CMP0141=NEW and MSVC_DEBUG_INFORMATION_FORMAT=Embedded are required87 # by the sccache tool.88 - name: Configure CMake89 run: >90 cmake -B ${{ steps.strings.outputs.build-output-dir }}91 -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}92 -DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}93 -DCMAKE_BUILD_TYPE=Debug94 -DCMAKE_C_COMPILER_LAUNCHER=sccache95 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache96 -DCMAKE_POLICY_DEFAULT_CMP0141=NEW97 -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded98 -DLLVM_ENABLE_RUNTIMES=libc99 -G Ninja100 -S ${{ github.workspace }}/runtimes101 102 - name: Build103 run: >104 cmake 105 --build ${{ steps.strings.outputs.build-output-dir }} 106 --parallel 107 --target libc108 109 - name: Test110 run: >111 cmake 112 --build ${{ steps.strings.outputs.build-output-dir }} 113 --parallel 114 --target check-libc115