-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc] add multi-platform pre-commit github actions (#119104)
We do not have CI coverage for Windows/MacOS and we regularly run into problem where changes break post-commit fullbuild which is not tested in pre-commit builds. This PR utilizes the github action to address such issues.
- Loading branch information
1 parent
f5f9650
commit f15cc6f
Showing
2 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# This workflow is for pre-commit testing of the LLVM-libc project. | ||
name: LLVM-libc Pre-commit Fullbuild Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- 'libc/**' | ||
- '.github/workflows/libc-fullbuild-tests.yml' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- c_compiler: clang | ||
cpp_compiler: clang++ | ||
# TODO: add back gcc build when it is fixed | ||
# - c_compiler: gcc | ||
# cpp_compiler: g++ | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
max-size: 1G | ||
key: libc_fullbuild_${{ matrix.c_compiler }} | ||
variant: sccache | ||
|
||
- name: Prepare dependencies (Ubuntu) | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-headers-generic linux-libc-dev | ||
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm | ||
- name: Set reusable strings | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | ||
echo "build-install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT" | ||
- name: Configure CMake | ||
run: > | ||
cmake -B ${{ steps.strings.outputs.build-output-dir }} | ||
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | ||
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | ||
-DCMAKE_BUILD_TYPE=MinSizeRel | ||
-DCMAKE_C_COMPILER_LAUNCHER=sccache | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache | ||
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }} | ||
-DLLVM_ENABLE_RUNTIMES="libc;compiler-rt" | ||
-DLLVM_LIBC_FULL_BUILD=ON | ||
-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 | ||
-G Ninja | ||
-S ${{ github.workspace }}/runtimes | ||
- name: Build | ||
run: > | ||
cmake | ||
--build ${{ steps.strings.outputs.build-output-dir }} | ||
--parallel | ||
--target install | ||
- name: Test | ||
run: > | ||
cmake | ||
--build ${{ steps.strings.outputs.build-output-dir }} | ||
--parallel | ||
--target check-libc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# This workflow is for pre-commit testing of the LLVM-libc project. | ||
name: LLVM-libc Pre-commit Overlay Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- 'libc/**' | ||
- '.github/workflows/libc-overlay-tests.yml' | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# TODO: add linux gcc when it is fixed | ||
- os: ubuntu-24.04 | ||
compiler: | ||
c_compiler: clang | ||
cpp_compiler: clang++ | ||
- os: windows-2022 | ||
compiler: | ||
c_compiler: clang-cl | ||
cpp_compiler: clang-cl | ||
- os: macos-14 | ||
compiler: | ||
c_compiler: clang | ||
cpp_compiler: clang++ | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup ccache | ||
uses: hendrikmuhs/ccache-action@v1 | ||
with: | ||
max-size: 1G | ||
key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }} | ||
variant: sccache | ||
|
||
- name: Prepare dependencies (Ubuntu) | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build | ||
- name: Prepare dependencies (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
choco install ninja | ||
- name: Prepare dependencies (macOS) | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew install ninja | ||
- name: Set reusable strings | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | ||
- name: Configure CMake | ||
run: > | ||
cmake -B ${{ steps.strings.outputs.build-output-dir }} | ||
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }} | ||
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }} | ||
-DCMAKE_BUILD_TYPE=MinSizeRel | ||
-DCMAKE_C_COMPILER_LAUNCHER=sccache | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache | ||
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW | ||
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded | ||
-DLLVM_ENABLE_RUNTIMES=libc | ||
-G Ninja | ||
-S ${{ github.workspace }}/runtimes | ||
- name: Build | ||
run: > | ||
cmake | ||
--build ${{ steps.strings.outputs.build-output-dir }} | ||
--parallel | ||
--config MinSizeRel | ||
--target libc | ||
- name: Test | ||
run: > | ||
cmake | ||
--build ${{ steps.strings.outputs.build-output-dir }} | ||
--parallel | ||
--target check-libc |