[llvm] [libc] add multi-platform pre-commit github actions (PR #119104)
Schrodinger ZHU Yifan via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 7 18:34:23 PST 2024
https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/119104
>From e6e227af2c9ab4141a8ca562b9423f3f19ac2f9a Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:20:35 -0500
Subject: [PATCH 01/13] [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 00000000000000..e69de29bb2d1d6
diff --git a/.github/workflows/libc-gpu-build.yml b/.github/workflows/libc-gpu-build.yml
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
new file mode 100644
index 00000000000000..63732a37277886
--- /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 at v4
+
+ - name: Run sccache-cache
+ uses: mozilla-actions/sccache-action at 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:22:57 -0500
Subject: [PATCH 02/13] [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 e69de29bb2d1d6..00000000000000
diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index 63732a37277886..e2e0fa0beadd96 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:23:49 -0500
Subject: [PATCH 03/13] [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 e2e0fa0beadd96..689a9d077eed65 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:26:37 -0500
Subject: [PATCH 04/13] [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 689a9d077eed65..daee174db34702 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:27:24 -0500
Subject: [PATCH 05/13] [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 daee174db34702..878ea4e9216473 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:35:15 -0500
Subject: [PATCH 06/13] 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 878ea4e9216473..5e54771d028c22 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:38:26 -0500
Subject: [PATCH 07/13] 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 5e54771d028c22..f93e03d1bb2e88 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 at 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:50:08 -0500
Subject: [PATCH 08/13] 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 f93e03d1bb2e88..c169105844eba8 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:51:21 -0500
Subject: [PATCH 09/13] 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 c169105844eba8..b95dd07e4edaef 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:54:17 -0500
Subject: [PATCH 10/13] 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 b95dd07e4edaef..a997b503ba2c9b 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:58:19 -0500
Subject: [PATCH 11/13] 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 a997b503ba2c9b..6b1668797d0711 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 21:13:07 -0500
Subject: [PATCH 12/13] 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 6b1668797d0711..c8b90ceacd2ff5 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 at 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 <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 21:34:01 -0500
Subject: [PATCH 13/13] 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 c8b90ceacd2ff5..8570f859f1fa7e 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 at 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
More information about the llvm-commits
mailing list