# This workflow is for pre-commit testing of the LLVM-libc project. name: LLVM-libc Pre-commit Fullbuild Tests permissions: contents: read on: pull_request: paths: - 'libc/**' - '.github/workflows/libc-fullbuild-tests.yml' jobs: libc-fullbuild: if: github.repository_owner == 'llvm' timeout-minutes: 60 name: libc-fullbuild on ${{ matrix.name }} runs-on: ${{ matrix.os }} container: image: ${{ (startsWith(matrix.os, 'ubuntu-24.04-arm') && 'ghcr.io/llvm/arm64v8/libc-ubuntu-24.04:latest@sha256:138636a45bb70f7b51a858b282e66291cb3c5c85371afee09032a5e09b263395') || 'ghcr.io/llvm/libc-ubuntu-24.04:latest@sha256:a902fb53bdad5e4a4bb6c11b6584e717a7b3d6e886f1ea58e11f95e46226249c'}} # We need to enable privileged containers so that certain libc tests # have the necessary permissions (like SYS_TIME). There are no security # implications as we are already running in an isolated VM. options: >- --privileged strategy: fail-fast: false matrix: # Build basic linux configuration with Debug/Release/MinSizeRel and all # other configurations in Debug only. include: - name: linux-x86_64-Debug os: ubuntu-24.04 build_type: Debug c_compiler: clang-23 cpp_compiler: clang++-23 target: x86_64-unknown-linux-llvm include_scudo: ON testing: BUILD - name: linux-x86_64-Release os: ubuntu-24.04 build_type: Release c_compiler: clang-23 cpp_compiler: clang++-23 target: x86_64-unknown-linux-llvm include_scudo: ON build_fuzzing_tests: ON - name: linux-x86_64-MinSizeRel os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: x86_64-unknown-linux-llvm include_scudo: ON testing: BUILD - name: linux-aarch64-clang os: ubuntu-24.04-arm build_type: Release c_compiler: clang-23 cpp_compiler: clang++-23 target: aarch64-unknown-linux-llvm include_scudo: ON - name: uefi-x86_64-clang os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: x86_64-unknown-uefi-llvm testing: SKIP - name: baremetal-armv6m os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: armv6m-none-eabi testing: SKIP - name: baremetal-armv7m os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: armv7m-none-eabi testing: SKIP - name: baremetal-armv7em os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: armv7em-none-eabi testing: SKIP - name: baremetal-armv8m os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: armv8m.main-none-eabi testing: SKIP - name: baremetal-armv8.1m os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: armv8.1m.main-none-eabi testing: SKIP - name: baremetal-riscv32 os: ubuntu-24.04 build_type: MinSizeRel c_compiler: clang-23 cpp_compiler: clang++-23 target: riscv32-unknown-elf testing: SKIP - name: amd-gpu os: ubuntu-24.04 build_type: Release c_compiler: clang-23 cpp_compiler: clang++-23 target: amdgcn-amd-amdhsa testing: SKIP # TODO: add back gcc build when it is fixed # - c_compiler: gcc # cpp_compiler: g++ steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false # Libc's build is relatively small comparing with other components of LLVM. # A fresh fullbuild takes about 190MiB of uncompressed disk space, which can # be compressed into ~40MiB. Limiting the cache size to 1G should be enough. # Prefer sccache as it is more modern. # Do not use direct GHAC access even though it is supported by sccache. GHAC rejects # frequent small object writes. - name: Setup ccache uses: hendrikmuhs/ccache-action@33522472633dbd32578e909b315f5ee43ba878ce # v1.2.22 with: max-size: 1G key: libc_fullbuild_v3_${{ matrix.target }}_${{ matrix.build_type }}_${{ matrix.c_compiler }} variant: sccache # Configure libc fullbuild with scudo. - name: Configure CMake run: | export RUNTIMES="libc" export CMAKE_FLAGS=" -G Ninja -S /__w/llvm-project/llvm-project/runtimes -B build -DCMAKE_ASM_COMPILER=${{ matrix.c_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_USE_LINKER=lld-23 -DCMAKE_INSTALL_PREFIX=/__w/llvm-project/llvm-project/install -DLIBC_COMPILE_OPTIONS_NATIVE='' " if [[ "${{ matrix.testing }}" != "SKIP" ]]; then export CMAKE_FLAGS="$CMAKE_FLAGS -DLIBC_TEST_SKIP_DEATH_TESTS=ON -DLIBC_TEST_SKIP_SHARED_TESTS=ON " fi if [[ "${{ matrix.include_scudo }}" == "ON" || "${{ matrix.build_fuzzing_tests }}" == "ON" ]]; then export RUNTIMES="$RUNTIMES;compiler-rt" fi if [[ "${{ matrix.include_scudo }}" == "ON" ]]; then export CMAKE_FLAGS="$CMAKE_FLAGS -DLLVM_LIBC_INCLUDE_SCUDO=ON -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON -DCOMPILER_RT_BUILD_GWP_ASAN=OFF -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF" fi case "${{ matrix.name }}" in baremetal-* ) cmake $CMAKE_FLAGS \ -C /__w/llvm-project/llvm-project/libc/cmake/caches/${{ matrix.target }}.cmake ;; *-gpu | uefi-* ) cmake \ -DLLVM_DEFAULT_TARGET_TRIPLE=${{ matrix.target }} \ -DLIBC_TARGET_TRIPLE=${{ matrix.target }} \ -DLLVM_ENABLE_RUNTIMES="$RUNTIMES" \ -DLLVM_LIBC_FULL_BUILD=ON \ $CMAKE_FLAGS ;; * ) cmake \ -DLLVM_ENABLE_RUNTIMES="$RUNTIMES" \ -DLLVM_LIBC_FULL_BUILD=ON \ $CMAKE_FLAGS ;; esac - name: Build shell: bash run: | TARGETS="install" if [[ "${{ matrix.build_fuzzing_tests }}" == "ON" ]]; then TARGETS="$TARGETS libc-fuzzer" fi cmake \ --build build \ --parallel \ --target $TARGETS - name: Build Test if: ${{ matrix.testing != 'SKIP' }} run: > cmake --build build --parallel --target check-libc-build - name: Run Test if: ${{ matrix.testing != 'SKIP' && matrix.testing != 'BUILD' }} run: > cmake --build build --parallel --target check-libc