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