1 # This workflow is for pre-commit testing of the LLVM-libc project.
2 name: LLVM-libc Pre-commit Overlay Tests
10 - '.github/workflows/libc-overlay-tests.yml'
14 runs-on: ${{ matrix.os }}
16 # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
20 # TODO: add linux gcc when it is fixed
28 cpp_compiler: clang-cl
35 - uses: actions/checkout@v4
37 # Libc's build is relatively small comparing with other components of LLVM.
38 # A fresh linux overlay takes about 180MiB of uncompressed disk space, which can
39 # be compressed into ~40MiB. MacOS and Windows overlay builds are less than 10MiB
40 # after compression. Limiting the cache size to 1G should be enough.
41 # Prefer sccache as it is modern and it has a guarantee to work with MSVC.
42 # Do not use direct GHAC access even though it is supported by sccache. GHAC rejects
43 # frequent small object writes.
45 uses: hendrikmuhs/ccache-action@v1
48 key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}
51 # MPFR is required by some of the mathlib tests.
52 - name: Prepare dependencies (Ubuntu)
53 if: runner.os == 'Linux'
56 sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build
58 # Chocolatey is shipped with Windows runners. Windows Server 2025 recommends WinGet.
59 # Consider migrating to WinGet when Windows Server 2025 is available.
60 - name: Prepare dependencies (Windows)
61 if: runner.os == 'Windows'
65 - name: Prepare dependencies (macOS)
66 if: runner.os == 'macOS'
70 - name: Set reusable strings
74 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
76 # Use MinSizeRel to reduce the size of the build.
77 # Notice that CMP0141=NEW and MSVC_DEBUG_INFORMATION_FORMAT=Embedded are required
78 # by the sccache tool.
79 - name: Configure CMake
81 cmake -B ${{ steps.strings.outputs.build-output-dir }}
82 -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
83 -DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
84 -DCMAKE_BUILD_TYPE=MinSizeRel
85 -DCMAKE_C_COMPILER_LAUNCHER=sccache
86 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
87 -DCMAKE_POLICY_DEFAULT_CMP0141=NEW
88 -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
89 -DLLVM_ENABLE_RUNTIMES=libc
91 -S ${{ github.workspace }}/runtimes
96 --build ${{ steps.strings.outputs.build-output-dir }}
104 --build ${{ steps.strings.outputs.build-output-dir }}