From e6e227af2c9ab4141a8ca562b9423f3f19ac2f9a Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:20:35 -0500 Subject: [PATCH 01/28] [libc] add multi-platform pre-commit github actions --- .github/workflows/libc-fullbuild-tests.yml | 0 .github/workflows/libc-gpu-build.yml | 0 .github/workflows/libc-overlay-tests.yml | 66 ++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/libc-fullbuild-tests.yml create mode 100644 .github/workflows/libc-gpu-build.yml create mode 100644 .github/workflows/libc-overlay-tests.yml diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/.github/workflows/libc-gpu-build.yml b/.github/workflows/libc-gpu-build.yml new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml new file mode 100644 index 0000000000000..63732a3727788 --- /dev/null +++ b/.github/workflows/libc-overlay-tests.yml @@ -0,0 +1,66 @@ +# 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: + env: + SCCACHE_GHA_ENABLED: "true" + runs-on: ${{ matrix.os }} + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + build_type: [Release, Debug] + compiler: [ + { c_compiler: gcc, cpp_compiler: g++ }, + { c_compiler: clang, cpp_compiler: clang++ }, + { c_compiler: clang-cl, cpp_compiler: clang-cl } + ] + exclude: + - os: windows-latest + compiler: { c_compiler: gcc, cpp_compiler: g++ } + - os: ubuntu-latest + compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } + - os: macos-latest + compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } + - os: macos-latest + compiler: { c_compiler: gcc, cpp_compiler: g++ } + + steps: + - uses: actions/checkout@v4 + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.6 + + - 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=${{ matrix.build_type }} + -DCMAKE_C_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DLLVM_ENABLE_RUNTIMES=libc + -G Ninja + -S ${{ github.workspace }}/runtimes + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }} + run: ninja check-libc From 49ca7bcb8dbc1ddc29e1fa5eed83ab1dea7488bb Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:22:57 -0500 Subject: [PATCH 02/28] [libc] add multi-platform pre-commit github actions --- .github/workflows/libc-gpu-build.yml | 0 .github/workflows/libc-overlay-tests.yml | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .github/workflows/libc-gpu-build.yml diff --git a/.github/workflows/libc-gpu-build.yml b/.github/workflows/libc-gpu-build.yml deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 63732a3727788..e2e0fa0beadd9 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -55,11 +55,10 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_ENABLE_RUNTIMES=libc - -G Ninja -S ${{ github.workspace }}/runtimes - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} From a16c16ead303a0ebaca4244ff371b0282defcfb4 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:23:49 -0500 Subject: [PATCH 03/28] [libc] add multi-platform pre-commit github actions --- .github/workflows/libc-overlay-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index e2e0fa0beadd9..689a9d077eed6 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -51,14 +51,14 @@ jobs: 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=${{ matrix.build_type }} + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_ENABLE_RUNTIMES=libc -S ${{ github.workspace }}/runtimes - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel --config RelWithDebInfo - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} From feb3428f837c2bc20d79c2cb86502ff383168ee2 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:26:37 -0500 Subject: [PATCH 04/28] [libc] add multi-platform pre-commit github actions --- .github/workflows/libc-overlay-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 689a9d077eed6..daee174db3470 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -61,5 +61,4 @@ jobs: run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel --config RelWithDebInfo - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: ninja check-libc + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target check-libc From d1af585efe6de04f90f8cd85aaeaa02713f308fa Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:27:24 -0500 Subject: [PATCH 05/28] [libc] add multi-platform pre-commit github actions --- .github/workflows/libc-overlay-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index daee174db3470..878ea4e921647 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -27,6 +27,8 @@ jobs: exclude: - os: windows-latest compiler: { c_compiler: gcc, cpp_compiler: g++ } + - os: windows-latest + compiler: { c_compiler: clang, cpp_compiler: clang++ } - os: ubuntu-latest compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } - os: macos-latest From 0cf345f131be1cd4e2fe42b6c16143c522047f7b Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:35:15 -0500 Subject: [PATCH 06/28] prepare to fix windows build --- .github/workflows/libc-overlay-tests.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 878ea4e921647..5e54771d028c2 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -60,7 +60,16 @@ jobs: -S ${{ github.workspace }}/runtimes - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel --config RelWithDebInfo + run: > + cmake + --build ${{ steps.strings.outputs.build-output-dir }} + --parallel + --config RelWithDebInfo + --target libc - name: Test - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target check-libc + run: > + cmake + --build ${{ steps.strings.outputs.build-output-dir }} + --parallel + --target check-libc From 008ffefe78cbdccee889d951c4c9ecb610a42f46 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:38:26 -0500 Subject: [PATCH 07/28] add ubuntu preparation step --- .github/workflows/libc-overlay-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 5e54771d028c2..f93e03d1bb2e8 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -41,6 +41,12 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.6 + + - name: Prepare dependencies (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y cmake ninja-build libmpfr-dev libgmp-dev libmpc-dev - name: Set reusable strings id: strings From 1263dbcf1c20203fdffcf6b3c743cc2abfafe310 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:50:08 -0500 Subject: [PATCH 08/28] setup ninja --- .github/workflows/libc-overlay-tests.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index f93e03d1bb2e8..c169105844eba 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -47,6 +47,18 @@ jobs: run: | sudo apt-get update sudo apt-get install -y cmake ninja-build libmpfr-dev libgmp-dev libmpc-dev + + - name: Prepare dependencies (Windows) + if: matrix.os == 'windows-latest' + run: | + winget install --silent --exact --force LLVM.LLVM + winget install --silent --exact --force Ninja-build.Ninja + echo "C:\\Program Files\\LLVM\\bin" >> $GITHUB_PATH + + - name: Prepare dependencies (macOS) + if: matrix.os == 'macos-latest' + run: | + brew install ninja - name: Set reusable strings id: strings @@ -63,6 +75,7 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_ENABLE_RUNTIMES=libc + -G Ninja -S ${{ github.workspace }}/runtimes - name: Build From a7738ed29490a70cd1a28afc73872d612c6283e6 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:51:21 -0500 Subject: [PATCH 09/28] remove build type --- .github/workflows/libc-overlay-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index c169105844eba..b95dd07e4edae 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -18,7 +18,6 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - build_type: [Release, Debug] compiler: [ { c_compiler: gcc, cpp_compiler: g++ }, { c_compiler: clang, cpp_compiler: clang++ }, From 8f3c0ee68c8337c2e015c1924370eb063cd0b15a Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:54:17 -0500 Subject: [PATCH 10/28] fix winget installation --- .github/workflows/libc-overlay-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index b95dd07e4edae..a997b503ba2c9 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -50,6 +50,7 @@ jobs: - name: Prepare dependencies (Windows) if: matrix.os == 'windows-latest' run: | + Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe winget install --silent --exact --force LLVM.LLVM winget install --silent --exact --force Ninja-build.Ninja echo "C:\\Program Files\\LLVM\\bin" >> $GITHUB_PATH From df708869248b8b122ce2e1a7d72e5b75488dc1c8 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 20:58:19 -0500 Subject: [PATCH 11/28] fix winget installation --- .github/workflows/libc-overlay-tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index a997b503ba2c9..6b1668797d071 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -50,7 +50,13 @@ jobs: - name: Prepare dependencies (Windows) if: matrix.os == 'windows-latest' run: | - Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe + $progressPreference = 'silentlyContinue' + Write-Host "Installing WinGet PowerShell module from PSGallery..." + Install-PackageProvider -Name NuGet -Force | Out-Null + Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null + Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." + Repair-WinGetPackageManager + Write-Host "Done." winget install --silent --exact --force LLVM.LLVM winget install --silent --exact --force Ninja-build.Ninja echo "C:\\Program Files\\LLVM\\bin" >> $GITHUB_PATH From 08d00ccb41aa730a142b44e8cf03d7fe594093da Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 21:13:07 -0500 Subject: [PATCH 12/28] more fixes --- .github/workflows/libc-overlay-tests.yml | 33 +++++++----------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 6b1668797d071..c8b90ceacd2ff 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -17,22 +17,22 @@ jobs: # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ ubuntu-24.04, windows-2022, macos-14 ] compiler: [ { c_compiler: gcc, cpp_compiler: g++ }, { c_compiler: clang, cpp_compiler: clang++ }, { c_compiler: clang-cl, cpp_compiler: clang-cl } ] exclude: - - os: windows-latest + - os: windows-2022 compiler: { c_compiler: gcc, cpp_compiler: g++ } - - os: windows-latest + - os: windows-2022 compiler: { c_compiler: clang, cpp_compiler: clang++ } - - os: ubuntu-latest + - os: ubuntu-24.04 compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } - - os: macos-latest + - os: macos-14 compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } - - os: macos-latest + - os: macos-14 compiler: { c_compiler: gcc, cpp_compiler: g++ } steps: @@ -42,30 +42,16 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.6 - name: Prepare dependencies (Ubuntu) - if: matrix.os == 'ubuntu-latest' + if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y cmake ninja-build libmpfr-dev libgmp-dev libmpc-dev + sudo apt-get install -y cmake libmpfr-dev libgmp-dev libmpc-dev - name: Prepare dependencies (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' run: | - $progressPreference = 'silentlyContinue' - Write-Host "Installing WinGet PowerShell module from PSGallery..." - Install-PackageProvider -Name NuGet -Force | Out-Null - Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null - Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." - Repair-WinGetPackageManager - Write-Host "Done." - winget install --silent --exact --force LLVM.LLVM - winget install --silent --exact --force Ninja-build.Ninja echo "C:\\Program Files\\LLVM\\bin" >> $GITHUB_PATH - - name: Prepare dependencies (macOS) - if: matrix.os == 'macos-latest' - run: | - brew install ninja - - name: Set reusable strings id: strings shell: bash @@ -81,7 +67,6 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_ENABLE_RUNTIMES=libc - -G Ninja -S ${{ github.workspace }}/runtimes - name: Build From fcb25009d25910aaa230ee6e0ef2b705847fd8d2 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 21:34:01 -0500 Subject: [PATCH 13/28] more fixes --- .github/workflows/libc-overlay-tests.yml | 41 +++++++++++------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index c8b90ceacd2ff..8570f859f1fa7 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -17,24 +17,23 @@ jobs: # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. fail-fast: false matrix: - os: [ ubuntu-24.04, windows-2022, macos-14 ] - compiler: [ - { c_compiler: gcc, cpp_compiler: g++ }, - { c_compiler: clang, cpp_compiler: clang++ }, - { c_compiler: clang-cl, cpp_compiler: clang-cl } - ] - exclude: - - os: windows-2022 - compiler: { c_compiler: gcc, cpp_compiler: g++ } - - os: windows-2022 - compiler: { c_compiler: clang, cpp_compiler: clang++ } - - os: ubuntu-24.04 - compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } + include: + - os: ubuntu-20.04 + compiler: + c_compiler: clang + cpp_compiler: clang++ + cmake_config: + - os: windows-latest + compiler: + c_compiler: clang-cl + cpp_compiler: clang-cl + cmake_config: -TClangCL - os: macos-14 - compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl } - - os: macos-14 - compiler: { c_compiler: gcc, cpp_compiler: g++ } - + compiler: + c_compiler: clang + cpp_compiler: clang++ + cmake_config: + steps: - uses: actions/checkout@v4 @@ -45,12 +44,7 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y cmake libmpfr-dev libgmp-dev libmpc-dev - - - name: Prepare dependencies (Windows) - if: runner.os == 'Windows' - run: | - echo "C:\\Program Files\\LLVM\\bin" >> $GITHUB_PATH + sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev - name: Set reusable strings id: strings @@ -67,6 +61,7 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_ENABLE_RUNTIMES=libc + ${{ matrix.cmake_config }} -S ${{ github.workspace }}/runtimes - name: Build From 0be378fc7d8eca8f4a6c1de12d87f9cee5acf5f6 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 21:34:23 -0500 Subject: [PATCH 14/28] more fixes --- .github/workflows/libc-overlay-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 8570f859f1fa7..ed6897e8077ee 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-20.04 + - os: ubuntu-24.04 compiler: c_compiler: clang cpp_compiler: clang++ From 779c80641034a4f710669c86f17cf260701972ec Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 21:54:35 -0500 Subject: [PATCH 15/28] enable fullbuild --- .github/workflows/libc-fullbuild-tests.yml | 71 ++++++++++++++++++++++ .github/workflows/libc-overlay-tests.yml | 1 + 2 files changed, 72 insertions(+) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index e69de29bb2d1d..e1700720ae95c 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -0,0 +1,71 @@ +# 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: + env: + SCCACHE_GHA_ENABLED: "true" + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - c_compiler: clang + cpp_compiler: clang++ + - c_compiler: gcc + cpp_compiler: g++ + steps: + - uses: actions/checkout@v4 + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.6 + + - name: Prepare dependencies (Ubuntu) + run: | + sudo apt-get update + sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build + + - 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=RelWithDebInfo + -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 + -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 diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index ed6897e8077ee..fbb912c3905a4 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -18,6 +18,7 @@ jobs: fail-fast: false matrix: include: + # TODO: add linux gcc when it is fixed - os: ubuntu-24.04 compiler: c_compiler: clang From 009b76cdf23b54e60e63bf1cfac5753cd1659ebc Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:01:52 -0500 Subject: [PATCH 16/28] fix --- .github/workflows/libc-fullbuild-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index e1700720ae95c..7b814ada7d839 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -30,7 +30,7 @@ jobs: - name: Prepare dependencies (Ubuntu) run: | sudo apt-get update - sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build + sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-headers-generic - name: Set reusable strings id: strings @@ -54,6 +54,7 @@ jobs: -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 From 6776e8d5ae1175a17aa49203e9bd5fede9e2a90e Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:05:04 -0500 Subject: [PATCH 17/28] fix --- .github/workflows/libc-fullbuild-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 7b814ada7d839..0b8688ef6d5b0 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -30,7 +30,7 @@ jobs: - 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 + sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-headers-generic linux-libc-dev - name: Set reusable strings id: strings From a9eba5e433b0f80fe2a0d88f2a99b56d4bd9acf1 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:09:12 -0500 Subject: [PATCH 18/28] fix --- .github/workflows/libc-fullbuild-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 0b8688ef6d5b0..d9cbd0c8325ad 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -31,6 +31,7 @@ jobs: 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/asm-generic /usr/include/asm - name: Set reusable strings id: strings From 8482b9d30865c5f1b4e481edad183029922a8c59 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:14:14 -0500 Subject: [PATCH 19/28] fix --- .github/workflows/libc-fullbuild-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index d9cbd0c8325ad..6f612c9a585cf 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -31,7 +31,7 @@ jobs: 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/asm-generic /usr/include/asm + sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm - name: Set reusable strings id: strings From 5c8fba19544786509ee46b0c8d075056c63adb06 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:26:15 -0500 Subject: [PATCH 20/28] skip gcc and speed up clang testing --- .github/workflows/libc-fullbuild-tests.yml | 5 +++-- .github/workflows/libc-overlay-tests.yml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 6f612c9a585cf..5947e07637cbd 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -19,8 +19,9 @@ jobs: include: - c_compiler: clang cpp_compiler: clang++ - - c_compiler: gcc - cpp_compiler: g++ + # TODO: add back gcc build when it is fixed + # - c_compiler: gcc + # cpp_compiler: g++ steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index fbb912c3905a4..9b8109d0f6705 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -23,7 +23,7 @@ jobs: compiler: c_compiler: clang cpp_compiler: clang++ - cmake_config: + cmake_config: -GNinja - os: windows-latest compiler: c_compiler: clang-cl @@ -45,7 +45,7 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev + sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build - name: Set reusable strings id: strings From 39e83dcc270455ef0044915c22807e8aa4076784 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:29:23 -0500 Subject: [PATCH 21/28] use windows-2022 instead of windows-latest --- .github/workflows/libc-overlay-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 9b8109d0f6705..125cbfd3bd4db 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -24,7 +24,7 @@ jobs: c_compiler: clang cpp_compiler: clang++ cmake_config: -GNinja - - os: windows-latest + - os: windows-2022 compiler: c_compiler: clang-cl cpp_compiler: clang-cl From 6f3b9ebf68fd03297e2118b6a0d9643dff9a5a5d Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:43:44 -0500 Subject: [PATCH 22/28] improve windows sccache hit --- .github/workflows/libc-overlay-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 125cbfd3bd4db..b05cc653e31ec 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -61,6 +61,8 @@ jobs: -DCMAKE_BUILD_TYPE=RelWithDebInfo -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 ${{ matrix.cmake_config }} -S ${{ github.workspace }}/runtimes From 0b4323b1c89a521e5b071ec2a316a1451adcf65e Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sat, 7 Dec 2024 22:53:24 -0500 Subject: [PATCH 23/28] try use ninja on all platforms --- .github/workflows/libc-overlay-tests.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index b05cc653e31ec..65d4daeaf7197 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -23,17 +23,14 @@ jobs: compiler: c_compiler: clang cpp_compiler: clang++ - cmake_config: -GNinja - os: windows-2022 compiler: c_compiler: clang-cl cpp_compiler: clang-cl - cmake_config: -TClangCL - os: macos-14 compiler: c_compiler: clang cpp_compiler: clang++ - cmake_config: steps: - uses: actions/checkout@v4 @@ -46,6 +43,16 @@ jobs: 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 @@ -64,7 +71,7 @@ jobs: -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded -DLLVM_ENABLE_RUNTIMES=libc - ${{ matrix.cmake_config }} + -G Ninja -S ${{ github.workspace }}/runtimes - name: Build From 19c4456e8ce791ff651efef8ae0069182cca5feb Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sun, 8 Dec 2024 12:14:20 -0500 Subject: [PATCH 24/28] switch caching --- .github/workflows/libc-fullbuild-tests.yml | 10 +++++++--- .github/workflows/libc-overlay-tests.yml | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 5947e07637cbd..9b4251b4a7bf7 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -25,8 +25,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.6 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1 + with: + max-size: 256M + key: ${{ github.job }}-${{ matrix.c_compiler }} + variant: sccache - name: Prepare dependencies (Ubuntu) run: | @@ -46,7 +50,7 @@ jobs: cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }} diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 65d4daeaf7197..43f40f7eea9ad 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -35,8 +35,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.6 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1 + with: + max-size: 256M + key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.c_compiler }} + variant: sccache - name: Prepare dependencies (Ubuntu) if: runner.os == 'Linux' @@ -65,7 +69,7 @@ jobs: 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=RelWithDebInfo + -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_POLICY_DEFAULT_CMP0141=NEW @@ -79,7 +83,7 @@ jobs: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel - --config RelWithDebInfo + --config MinSizeRel --target libc - name: Test From 1b0d03b0392e85e041a95fdfd94a884238fccd7a Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sun, 8 Dec 2024 12:16:16 -0500 Subject: [PATCH 25/28] switch caching (fix syntax) --- .github/workflows/libc-fullbuild-tests.yml | 6 +++--- .github/workflows/libc-overlay-tests.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 9b4251b4a7bf7..3993fe4065967 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -28,9 +28,9 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 with: - max-size: 256M - key: ${{ github.job }}-${{ matrix.c_compiler }} - variant: sccache + max-size: 256M + key: ${{ github.job }}-${{ matrix.c_compiler }} + variant: sccache - name: Prepare dependencies (Ubuntu) run: | diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 43f40f7eea9ad..329f601eb9bb8 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -38,9 +38,9 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 with: - max-size: 256M - key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.c_compiler }} - variant: sccache + max-size: 256M + key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.c_compiler }} + variant: sccache - name: Prepare dependencies (Ubuntu) if: runner.os == 'Linux' From 2356ffddb383acdf8ed7302981d865e6be5c2711 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sun, 8 Dec 2024 12:27:45 -0500 Subject: [PATCH 26/28] switch caching (changing key) --- .github/workflows/libc-fullbuild-tests.yml | 4 ++-- .github/workflows/libc-overlay-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 3993fe4065967..5f7025ae381f5 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -26,10 +26,10 @@ jobs: - uses: actions/checkout@v4 - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 + uses: hendrikmuhs/ccache-action@v1.2 with: max-size: 256M - key: ${{ github.job }}-${{ matrix.c_compiler }} + key: libc_fullbuild_${{ matrix.c_compiler }} variant: sccache - name: Prepare dependencies (Ubuntu) diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 329f601eb9bb8..ace382657dd4d 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -39,7 +39,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1 with: max-size: 256M - key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.c_compiler }} + key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }} variant: sccache - name: Prepare dependencies (Ubuntu) From 2e014bdec9d2483a2716160291c31a7583b0ceb0 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sun, 8 Dec 2024 12:35:45 -0500 Subject: [PATCH 27/28] switch caching (fix) --- .github/workflows/libc-fullbuild-tests.yml | 2 -- .github/workflows/libc-overlay-tests.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 5f7025ae381f5..252ed0e08ab6b 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -10,8 +10,6 @@ on: jobs: build: - env: - SCCACHE_GHA_ENABLED: "true" runs-on: ubuntu-24.04 strategy: fail-fast: false diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index ace382657dd4d..2fb1e2979982c 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -10,8 +10,6 @@ on: jobs: build: - env: - SCCACHE_GHA_ENABLED: "true" runs-on: ${{ matrix.os }} strategy: # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. From ad8b7d80c328421465c41ff85754141b5418fd96 Mon Sep 17 00:00:00 2001 From: schrodingerzhu Date: Sun, 8 Dec 2024 13:12:38 -0500 Subject: [PATCH 28/28] lift uncompressed local storage size to 1G --- .github/workflows/libc-fullbuild-tests.yml | 2 +- .github/workflows/libc-overlay-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml index 252ed0e08ab6b..fb73aa392f343 100644 --- a/.github/workflows/libc-fullbuild-tests.yml +++ b/.github/workflows/libc-fullbuild-tests.yml @@ -26,7 +26,7 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1.2 with: - max-size: 256M + max-size: 1G key: libc_fullbuild_${{ matrix.c_compiler }} variant: sccache diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml index 2fb1e2979982c..d0cdfdef99fe9 100644 --- a/.github/workflows/libc-overlay-tests.yml +++ b/.github/workflows/libc-overlay-tests.yml @@ -36,7 +36,7 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 with: - max-size: 256M + max-size: 1G key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }} variant: sccache