185 lines · yaml
1# This workflow is for pre-commit testing of the LLVM-libc project.2name: LLVM-libc Pre-commit Fullbuild Tests3permissions:4 contents: read5on: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: false17 matrix:18 # Build basic linux configuration with Debug/Release/MinSizeRel and all19 # other configurations in Debug only.20 include:21 - os: ubuntu-24.0422 build_type: Debug23 c_compiler: clang-2224 cpp_compiler: clang++-2225 target: x86_64-unknown-linux-llvm26 include_scudo: ON27 - os: ubuntu-24.0428 build_type: Release29 c_compiler: clang-2230 cpp_compiler: clang++-2231 target: x86_64-unknown-linux-llvm32 include_scudo: ON33 - os: ubuntu-24.0434 build_type: MinSizeRel35 c_compiler: clang-2236 cpp_compiler: clang++-2237 target: x86_64-unknown-linux-llvm38 include_scudo: ON39 - os: ubuntu-24.04-arm40 build_type: Debug41 c_compiler: clang-2242 cpp_compiler: clang++-2243 target: aarch64-unknown-linux-llvm44 include_scudo: ON45 - os: ubuntu-24.0446 build_type: Debug47 c_compiler: clang-2248 cpp_compiler: clang++-2249 target: x86_64-unknown-uefi-llvm50 include_scudo: OFF51 - os: ubuntu-24.0452 build_type: MinSizeRel53 c_compiler: clang-2254 cpp_compiler: clang++-2255 target: armv6m-none-eabi56 include_scudo: OFF57 - os: ubuntu-24.0458 build_type: MinSizeRel59 c_compiler: clang-2260 cpp_compiler: clang++-2261 target: armv7m-none-eabi62 include_scudo: OFF63 - os: ubuntu-24.0464 build_type: MinSizeRel65 c_compiler: clang-2266 cpp_compiler: clang++-2267 target: armv7em-none-eabi68 include_scudo: OFF69 - os: ubuntu-24.0470 build_type: MinSizeRel71 c_compiler: clang-2272 cpp_compiler: clang++-2273 target: armv8m.main-none-eabi74 include_scudo: OFF75 - os: ubuntu-24.0476 build_type: MinSizeRel77 c_compiler: clang-2278 cpp_compiler: clang++-2279 target: armv8.1m.main-none-eabi80 include_scudo: OFF81 - os: ubuntu-24.0482 build_type: MinSizeRel83 c_compiler: clang-2284 cpp_compiler: clang++-2285 target: riscv32-unknown-elf86 include_scudo: OFF87 # TODO: add back gcc build when it is fixed88 # - c_compiler: gcc89 # cpp_compiler: g++90 steps:91 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.092 93 # Libc's build is relatively small comparing with other components of LLVM.94 # A fresh fullbuild takes about 190MiB of uncompressed disk space, which can95 # be compressed into ~40MiB. Limiting the cache size to 1G should be enough.96 # Prefer sccache as it is more modern.97 # Do not use direct GHAC access even though it is supported by sccache. GHAC rejects98 # frequent small object writes.99 - name: Setup ccache100 uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20101 with:102 max-size: 1G103 key: libc_fullbuild_${{ matrix.c_compiler }}104 variant: sccache105 106 # Notice:107 # - MPFR is required by some of the mathlib tests.108 # - Debian has a multilib setup, so we need to symlink the asm directory.109 # For more information, see https://wiki.debian.org/Multiarch/LibraryPathOverview110 - name: Prepare dependencies (Ubuntu)111 run: |112 wget https://apt.llvm.org/llvm.sh113 chmod +x llvm.sh114 sudo ./llvm.sh 22115 sudo apt-get update116 sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev117 sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm118 119 - name: Set reusable strings120 id: strings121 shell: bash122 run: |123 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"124 echo "build-install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT"125 126 # Configure libc fullbuild with scudo.127 # Use MinSizeRel to reduce the size of the build.128 - name: Configure CMake129 run: |130 export RUNTIMES="libc"131 132 export CMAKE_FLAGS="133 -G Ninja134 -S ${{ github.workspace }}/runtimes135 -B ${{ steps.strings.outputs.build-output-dir }}136 -DCMAKE_ASM_COMPILER=${{ matrix.c_compiler }}137 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}138 -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}139 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}140 -DCMAKE_C_COMPILER_LAUNCHER=sccache141 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache142 -DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}"143 144 if [[ ${{ matrix.include_scudo}} == "ON" ]]; then145 export RUNTIMES="$RUNTIMES;compiler-rt"146 export CMAKE_FLAGS="$CMAKE_FLAGS147 -DLLVM_LIBC_INCLUDE_SCUDO=ON148 -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON149 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF150 -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF"151 fi152 153 case "${{ matrix.target }}" in154 *-none-eabi|riscv32-unknown-elf)155 cmake $CMAKE_FLAGS \156 -C ${{ github.workspace }}/libc/cmake/caches/${{ matrix.target }}.cmake157 ;;158 *)159 cmake -DLLVM_RUNTIME_TARGETS=${{ matrix.target }} \160 -DLLVM_ENABLE_RUNTIMES="$RUNTIMES" \161 -DLLVM_LIBC_FULL_BUILD=ON \162 $CMAKE_FLAGS163 ;;164 esac165 166 - name: Build167 run: >168 cmake 169 --build ${{ steps.strings.outputs.build-output-dir }} 170 --parallel171 --target install172 173 - name: Test174 # Skip UEFI and baremetal tests until we have testing set up.175 if: ${{176 !endsWith(matrix.target, '-uefi-llvm') &&177 !endsWith(matrix.target, '-none-eabi') &&178 matrix.target != 'riscv32-unknown-elf'179 }}180 run: >181 cmake 182 --build ${{ steps.strings.outputs.build-output-dir }} 183 --parallel184 --target check-libc185