|
| 1 | +# This workflow is for pre-commit testing of the LLVM-libc project. |
| 2 | +name: LLVM-libc Pre-commit Overlay Tests |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + branches: [ "main" ] |
| 7 | + paths: |
| 8 | + - 'libc/**' |
| 9 | + - '.github/workflows/libc-overlay-tests.yml' |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + # TODO: add linux gcc when it is fixed |
| 20 | + - os: ubuntu-24.04 |
| 21 | + compiler: |
| 22 | + c_compiler: clang |
| 23 | + cpp_compiler: clang++ |
| 24 | + - os: windows-2022 |
| 25 | + compiler: |
| 26 | + c_compiler: clang-cl |
| 27 | + cpp_compiler: clang-cl |
| 28 | + - os: macos-14 |
| 29 | + compiler: |
| 30 | + c_compiler: clang |
| 31 | + cpp_compiler: clang++ |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Setup ccache |
| 37 | + uses: hendrikmuhs/ccache-action@v1 |
| 38 | + with: |
| 39 | + max-size: 1G |
| 40 | + key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }} |
| 41 | + variant: sccache |
| 42 | + |
| 43 | + - name: Prepare dependencies (Ubuntu) |
| 44 | + if: runner.os == 'Linux' |
| 45 | + run: | |
| 46 | + sudo apt-get update |
| 47 | + sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build |
| 48 | + |
| 49 | + - name: Prepare dependencies (Windows) |
| 50 | + if: runner.os == 'Windows' |
| 51 | + run: | |
| 52 | + choco install ninja |
| 53 | + |
| 54 | + - name: Prepare dependencies (macOS) |
| 55 | + if: runner.os == 'macOS' |
| 56 | + run: | |
| 57 | + brew install ninja |
| 58 | +
|
| 59 | + - name: Set reusable strings |
| 60 | + id: strings |
| 61 | + shell: bash |
| 62 | + run: | |
| 63 | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" |
| 64 | +
|
| 65 | + - name: Configure CMake |
| 66 | + run: > |
| 67 | + cmake -B ${{ steps.strings.outputs.build-output-dir }} |
| 68 | + -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }} |
| 69 | + -DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }} |
| 70 | + -DCMAKE_BUILD_TYPE=MinSizeRel |
| 71 | + -DCMAKE_C_COMPILER_LAUNCHER=sccache |
| 72 | + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache |
| 73 | + -DCMAKE_POLICY_DEFAULT_CMP0141=NEW |
| 74 | + -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded |
| 75 | + -DLLVM_ENABLE_RUNTIMES=libc |
| 76 | + -G Ninja |
| 77 | + -S ${{ github.workspace }}/runtimes |
| 78 | +
|
| 79 | + - name: Build |
| 80 | + run: > |
| 81 | + cmake |
| 82 | + --build ${{ steps.strings.outputs.build-output-dir }} |
| 83 | + --parallel |
| 84 | + --config MinSizeRel |
| 85 | + --target libc |
| 86 | +
|
| 87 | + - name: Test |
| 88 | + run: > |
| 89 | + cmake |
| 90 | + --build ${{ steps.strings.outputs.build-output-dir }} |
| 91 | + --parallel |
| 92 | + --target check-libc |
0 commit comments