From f7312eefbba68d4ab268b2269d4ccd3f90635e5a Mon Sep 17 00:00:00 2001 From: "jiliang.ljl" Date: Wed, 11 Mar 2026 10:01:04 +0800 Subject: [PATCH 1/5] build: add clang ci --- .github/workflows/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abfd4d73..34ccc237 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,12 +81,19 @@ jobs: - os: macos-15 platform: macos-arm64 arch_flag: "" # ARM64 uses auto-detection + compiler: default - os: ubuntu-24.04-arm platform: linux-arm64 arch_flag: "" # ARM64 uses auto-detection + compiler: default - os: ubuntu-24.04 platform: linux-x64 arch_flag: "" # Use native CPU microarchitecture + compiler: default + - os: ubuntu-24.04 + platform: linux-x64-clang + arch_flag: "" + compiler: clang steps: - name: Checkout code @@ -101,6 +108,15 @@ jobs: cache: 'pip' cache-dependency-path: 'pyproject.toml' + - name: Install Clang + if: matrix.compiler == 'clang' + run: | + sudo apt-get update + sudo apt-get install -y clang + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + shell: bash + - name: Set up environment variables run: | # Set number of processors for parallel builds From f80598c027cea6f445b8d5ae862829537ed1fc50 Mon Sep 17 00:00:00 2001 From: "jiliang.ljl" Date: Mon, 16 Mar 2026 14:38:46 +0800 Subject: [PATCH 2/5] add lscpu --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34ccc237..daf712bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,6 +123,7 @@ jobs: if [[ "${{ matrix.platform }}" == "macos-arm64" ]]; then NPROC=$(sysctl -n hw.ncpu 2>/dev/null || echo 2) else + lscpu NPROC=$(nproc 2>/dev/null || echo 2) fi echo "NPROC=$NPROC" >> $GITHUB_ENV From 9ab3c8b7d04eeb27d45deb894dcde0b4f5546b5d Mon Sep 17 00:00:00 2001 From: "jiliang.ljl" Date: Fri, 20 Mar 2026 10:24:05 +0800 Subject: [PATCH 3/5] add clang ci --- .github/workflows/01-ci-pipeline.yml | 9 ++++++++ .github/workflows/03-macos-linux-build.yml | 25 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/01-ci-pipeline.yml b/.github/workflows/01-ci-pipeline.yml index 290b9c8a..e814a9b1 100644 --- a/.github/workflows/01-ci-pipeline.yml +++ b/.github/workflows/01-ci-pipeline.yml @@ -49,6 +49,15 @@ jobs: platform: linux-x64 os: ubuntu-24.04 + build-and-test-linux-x64-clang: + name: Build & Test (linux-x64-clang) + needs: lint + uses: ./.github/workflows/03-macos-linux-build.yml + with: + platform: linux-x64-clang + os: ubuntu-24.04 + compiler: clang + build-android: name: Build & Test (android) needs: lint diff --git a/.github/workflows/03-macos-linux-build.yml b/.github/workflows/03-macos-linux-build.yml index 9ec52cc7..1da93afb 100644 --- a/.github/workflows/03-macos-linux-build.yml +++ b/.github/workflows/03-macos-linux-build.yml @@ -11,6 +11,11 @@ on: description: 'GitHub Actions runner OS' required: true type: string + compiler: + description: 'C++ compiler to use (gcc or clang)' + required: false + type: string + default: 'gcc' permissions: contents: read @@ -42,6 +47,18 @@ jobs: cache: 'pip' cache-dependency-path: 'pyproject.toml' + - name: Install Clang + if: inputs.compiler == 'clang' + run: | + sudo apt-get update -y + sudo apt-get install -y clang + shell: bash + + - name: Print CPU info + if: runner.os == 'Linux' + run: lscpu + shell: bash + - name: Set up environment variables run: | # Set number of processors for parallel builds @@ -52,7 +69,13 @@ jobs: fi echo "NPROC=$NPROC" >> $GITHUB_ENV echo "Using $NPROC parallel jobs for builds" - + + # Set compiler when clang is requested + if [[ "${{ inputs.compiler }}" == "clang" ]]; then + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + fi + # Add Python user base bin to PATH for pip-installed CLI tools echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH shell: bash From ff6de314c4c404013fa712ddcb65d043e5dd8f5d Mon Sep 17 00:00:00 2001 From: "jiliang.ljl" Date: Fri, 20 Mar 2026 18:12:10 +0800 Subject: [PATCH 4/5] install libomp-dev --- .github/workflows/03-macos-linux-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/03-macos-linux-build.yml b/.github/workflows/03-macos-linux-build.yml index 1da93afb..91727a17 100644 --- a/.github/workflows/03-macos-linux-build.yml +++ b/.github/workflows/03-macos-linux-build.yml @@ -25,7 +25,7 @@ jobs: build-and-test: name: Build & Test (${{ inputs.platform }}) runs-on: ${{ inputs.os }} - + strategy: fail-fast: false matrix: @@ -51,7 +51,7 @@ jobs: if: inputs.compiler == 'clang' run: | sudo apt-get update -y - sudo apt-get install -y clang + sudo apt-get install -y clang libomp-dev shell: bash - name: Print CPU info @@ -94,7 +94,7 @@ jobs: - name: Build from source run: | cd "$GITHUB_WORKSPACE" - + CMAKE_GENERATOR="Unix Makefiles" \ CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \ python -m pip install -v . \ From 46c0bde70cc40e1d03ecdb4d6ab1d228e0a4241a Mon Sep 17 00:00:00 2001 From: "jiliang.ljl" Date: Fri, 20 Mar 2026 18:14:26 +0800 Subject: [PATCH 5/5] address comments --- .github/workflows/03-macos-linux-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/03-macos-linux-build.yml b/.github/workflows/03-macos-linux-build.yml index 91727a17..5281dd02 100644 --- a/.github/workflows/03-macos-linux-build.yml +++ b/.github/workflows/03-macos-linux-build.yml @@ -15,7 +15,7 @@ on: description: 'C++ compiler to use (gcc or clang)' required: false type: string - default: 'gcc' + default: '' permissions: contents: read @@ -48,7 +48,7 @@ jobs: cache-dependency-path: 'pyproject.toml' - name: Install Clang - if: inputs.compiler == 'clang' + if: inputs.compiler == 'clang' && runner.os == 'Linux' run: | sudo apt-get update -y sudo apt-get install -y clang libomp-dev