1# This workflow is for pre-commit testing of the LLVM-libc project. 2name: LLVM-libc Pre-commit Fullbuild Tests 3permissions: 4 contents: read 5on: 6 pull_request: 7 branches: [ "main" ] 8 paths: 9 - 'libc/**' 10 - '.github/workflows/libc-fullbuild-tests.yml' 11 12jobs: 13 build: 14 runs-on: ${{ matrix.os }} 15 strategy: 16 fail-fast: false 17 matrix: 18 include: 19 - os: ubuntu-24.04 20 ccache-variant: sccache 21 c_compiler: clang 22 cpp_compiler: clang++ 23 # TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved. 24 - os: ubuntu-24.04-arm 25 ccache-variant: ccache 26 c_compiler: clang 27 cpp_compiler: clang++ 28 # TODO: add back gcc build when it is fixed 29 # - c_compiler: gcc 30 # cpp_compiler: g++ 31 steps: 32 - uses: actions/checkout@v4 33 34 # Libc's build is relatively small comparing with other components of LLVM. 35 # A fresh fullbuild takes about 190MiB of uncompressed disk space, which can 36 # be compressed into ~40MiB. Limiting the cache size to 1G should be enough. 37 # Prefer sccache as it is more modern. 38 # Do not use direct GHAC access even though it is supported by sccache. GHAC rejects 39 # frequent small object writes. 40 - name: Setup ccache 41 uses: hendrikmuhs/ccache-action@v1.2 42 with: 43 max-size: 1G 44 key: libc_fullbuild_${{ matrix.c_compiler }} 45 variant: ${{ matrix.ccache-variant }} 46 47 # Notice: 48 # - MPFR is required by some of the mathlib tests. 49 # - Debian has a multilib setup, so we need to symlink the asm directory. 50 # For more information, see https://wiki.debian.org/Multiarch/LibraryPathOverview 51 - name: Prepare dependencies (Ubuntu) 52 run: | 53 sudo apt-get update 54 sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev 55 sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm 56 57 - name: Set reusable strings 58 id: strings 59 shell: bash 60 run: | 61 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" 62 echo "build-install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT" 63 64 # Configure libc fullbuild with scudo. 65 # Use MinSizeRel to reduce the size of the build. 66 - name: Configure CMake 67 run: > 68 cmake -B ${{ steps.strings.outputs.build-output-dir }} 69 -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} 70 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} 71 -DCMAKE_BUILD_TYPE=MinSizeRel 72 -DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} 73 -DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} 74 -DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }} 75 -DLLVM_ENABLE_RUNTIMES="libc;compiler-rt" 76 -DLLVM_LIBC_FULL_BUILD=ON 77 -DLLVM_LIBC_INCLUDE_SCUDO=ON 78 -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON 79 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF 80 -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF 81 -G Ninja 82 -S ${{ github.workspace }}/runtimes 83 84 - name: Build 85 run: > 86 cmake 87 --build ${{ steps.strings.outputs.build-output-dir }} 88 --parallel 89 --target install 90 91 - name: Test 92 run: > 93 cmake 94 --build ${{ steps.strings.outputs.build-output-dir }} 95 --parallel 96 --target check-libc 97