Skip to content

build: add clang ci#214

Open
egolearner wants to merge 1 commit intomainfrom
add-clang-ci
Open

build: add clang ci#214
egolearner wants to merge 1 commit intomainfrom
add-clang-ci

Conversation

@egolearner
Copy link
Collaborator

@egolearner egolearner commented Mar 11, 2026

Greptile Summary

This PR extends the CI matrix in .github/workflows/main.yml to add a Clang build job (linux-x64-clang) alongside the existing GCC-default jobs, enabling clang-compatibility checks on Linux x64.

  • Adds a new matrix entry linux-x64-clang (runs on ubuntu-24.04) with a compiler: clang property.
  • Adds a compiler: default property to the three pre-existing matrix entries to make the matrix schema consistent.
  • Adds a conditional "Install Clang" step (if: matrix.compiler == 'clang') that installs clang via apt-get and exports CC=clang / CXX=clang++ into $GITHUB_ENV, making the compiler available to all downstream steps (CMake build, C++ tests, C++ examples).
  • The environment-variable approach ($GITHUB_ENV) is the correct GitHub Actions mechanism for propagating values across steps, and both the Build from source (scikit-build-core/CMake) and Run C++ Examples (standalone CMake) steps will automatically pick up CC/CXX.
  • Minor concern: clang is installed without a pinned version, unlike every other tool in the workflow (cmake, pybind11, ninja, etc.), which could lead to silent version drift.

Confidence Score: 4/5

  • This PR is safe to merge; it only adds a new CI job and does not touch any production code.
  • The change is purely additive (a new CI matrix entry), is structurally sound, and uses the correct GitHub Actions patterns. The only concern is the unpinned clang version, which is a best-practice issue rather than a correctness bug.
  • No files require special attention beyond the minor version-pinning note in .github/workflows/main.yml.

Important Files Changed

Filename Overview
.github/workflows/main.yml Adds a new linux-x64-clang matrix entry and a conditional "Install Clang" step. The approach is correct and well-structured, with one minor concern: the clang package is not version-pinned, unlike other dependencies in the workflow.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Push / PR / workflow_dispatch] --> B[lint job\nCode Quality Checks\nubuntu-24.04]
    B --> C{Matrix: build-and-test}
    C --> D[macos-arm64\nmacos-15\ncompiler: default]
    C --> E[linux-arm64\nubuntu-24.04-arm\ncompiler: default]
    C --> F[linux-x64\nubuntu-24.04\ncompiler: default]
    C --> G[linux-x64-clang ✨ NEW\nubuntu-24.04\ncompiler: clang]

    G --> H[Install Clang\napt-get install clang\nCC=clang / CXX=clang++]
    H --> I[Build from source\npip install via CMake]
    I --> J[Run C++ Tests]
    J --> K[Run Python Tests]
    K --> L[Run C++ Examples]

    F --> M[Build from source\npip install via CMake\ndefault GCC]
    M --> N[Run C++ Tests]
    N --> O[Run Python Tests]
    O --> P[Run C++ Examples]
Loading

Last reviewed commit: f7312ee

Greptile also left 1 inline comment on this PR.

if: matrix.compiler == 'clang'
run: |
sudo apt-get update
sudo apt-get install -y clang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang version not pinned

apt-get install -y clang installs whatever version Ubuntu 24.04 currently defaults to (currently clang-18, but this can change with future apt updates). This makes the CI non-deterministic — a future Ubuntu package update could silently switch the compiler version and introduce unexpected build failures or behaviour changes. Pinning to a specific version (e.g. clang-18) is more reproducible and consistent with how other tools in this workflow are version-locked (e.g. cmake==3.30.0, pybind11==3.0).

Suggested change
sudo apt-get install -y clang
sudo apt-get install -y clang-18
echo "CC=clang-18" >> $GITHUB_ENV
echo "CXX=clang++-18" >> $GITHUB_ENV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant