From cd1518c775b71e8f9979c3509394c161eaf0c5f9 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 24 Sep 2026 01:43:38 +0000 Subject: [PATCH 1/3] clang-tidy: Add version 22.1.8 --- .github/workflows/build-clang-tidy.yml | 108 +++++++++++++++++++++++++ docs/packages/clang-tidy.yaml | 5 ++ 2 files changed, 113 insertions(+) create mode 100644 .github/workflows/build-clang-tidy.yml create mode 100644 docs/packages/clang-tidy.yaml diff --git a/.github/workflows/build-clang-tidy.yml b/.github/workflows/build-clang-tidy.yml new file mode 100644 index 00000000000..7aef34fef38 --- /dev/null +++ b/.github/workflows/build-clang-tidy.yml @@ -0,0 +1,108 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/ssciwr/clang-tidy-wheel/blob/main/.github/workflows/release.yml +name: Build clang-tidy wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/clang-tidy.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-clang-tidy.yml' + - 'docs/packages/clang-tidy.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-clang-tidy.yml' + - 'docs/packages/clang-tidy.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + # ssciwr/clang-tidy-wheel has no v22.1.8 tag yet; pin the commit whose + # CMakeLists.txt/pyproject.toml this workflow was written against and + # override clang-tidy_version.txt the same way upstream's own + # workflow_dispatch(llvm_version) input does. + CLANG_TIDY_WHEEL_REF: 0dc6a6edd1f404d5f0b84b59872f9b6d22211134 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: clang-tidy + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build clang-tidy ${{ matrix.version }} py2.py3-none-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 1440 # full LLVM/clang compile from source; unlike clang-format-wheel this + # upstream CMakeLists.txt does not restrict LLVM_TARGETS_TO_BUILD + + env: + CLANG_TIDY_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout clang-tidy-wheel + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: ssciwr/clang-tidy-wheel + ref: ${{ env.CLANG_TIDY_WHEEL_REF }} + persist-credentials: false + + - name: Set clang-tidy_version.txt to ${{ env.CLANG_TIDY_VERSION }} + run: echo "${CLANG_TIDY_VERSION}" > clang-tidy_version.txt + + - name: Build wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + # wheel.py-api = "py2.py3", so one build serves every interpreter. + only: cp312-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # Repeats pyproject.toml's own `environment` table: CIBW_ENVIRONMENT replaces + # rather than merges with it (gotcha 107). + CIBW_ENVIRONMENT: >- + CMAKE_GENERATOR=Ninja + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: clang-tidy-${{ env.CLANG_TIDY_VERSION }}-py2.py3-none-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish clang-tidy ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: clang-tidy-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/clang-tidy.yaml b/docs/packages/clang-tidy.yaml new file mode 100644 index 00000000000..8d35d8e6073 --- /dev/null +++ b/docs/packages/clang-tidy.yaml @@ -0,0 +1,5 @@ +package-name: clang-tidy +source-code: https://github.com/ssciwr/clang-tidy-wheel +license: Apache 2.0 +versions: +- version: 22.1.8 From 8323ff5f1e3eaeaf36ad74994a3d4ad746462d04 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 25 Sep 2026 10:48:14 +0000 Subject: [PATCH 2/3] clang-tidy: Remove the checkout's clang_tidy/ before testing pytest /project/test puts /project on sys.path (test/ is a package), so `import clang_tidy` resolved to the source tree, which has no data/bin/, instead of the installed wheel. Mirror upstream's own release.yml, which sets CIBW_BEFORE_TEST: rm -rf {package}/clang_tidy for this reason. --- .github/workflows/build-clang-tidy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-clang-tidy.yml b/.github/workflows/build-clang-tidy.yml index 7aef34fef38..3c4e2247b46 100644 --- a/.github/workflows/build-clang-tidy.yml +++ b/.github/workflows/build-clang-tidy.yml @@ -78,6 +78,7 @@ jobs: only: cp312-manylinux_riscv64 env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_BEFORE_TEST: rm -rf {package}/clang_tidy # Repeats pyproject.toml's own `environment` table: CIBW_ENVIRONMENT replaces # rather than merges with it (gotcha 107). CIBW_ENVIRONMENT: >- From e0100986c61b8d6a3f76fefba6fe3aa6fce12b35 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 27 Sep 2026 09:15:33 +0000 Subject: [PATCH 3/3] clang-tidy: Set CI=1 for the test phase, as upstream does After a green 12h build, 6 of 7 tests passed and test_include_iostream failed with "'iostream' file not found". The -v include search list holds only clang's resource dir, /usr/local/include and /usr/include: clang found no GCC installation. The manylinux_2_39_riscv64 image's compiler is the system GCC 14.3.1 under /usr/lib/gcc/riscv64-redhat-linux, and clang 22's RISCV64Triples list ("riscv64-unknown-linux-gnu", "riscv64-unknown-elf", plus the vendorless "riscv64-linux-gnu") has no redhat entry, unlike x86_64/aarch64. Debian/Ubuntu riscv64 hosts are found through "riscv64-linux-gnu", so this is the test container, not the wheel. Upstream never runs this test in a Linux container either: its release.yml sets CIBW_TEST_SKIP: "*linux*", and the test itself is skipif(CI and linux) for ssciwr/clang-tidy-wheel#30, with CI=1 set in the Dockerfile upstream tests Linux wheels in (f04a633). Setting CI=1 in CIBW_TEST_ENVIRONMENT lets that marker fire and keeps the other six tests, including test_main's real clang-tidy run. --- .github/workflows/build-clang-tidy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-clang-tidy.yml b/.github/workflows/build-clang-tidy.yml index 3c4e2247b46..84180a541da 100644 --- a/.github/workflows/build-clang-tidy.yml +++ b/.github/workflows/build-clang-tidy.yml @@ -79,6 +79,10 @@ jobs: env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} CIBW_BEFORE_TEST: rm -rf {package}/clang_tidy + # Upstream tests its Linux wheels with CI=1 so test_include_iostream skips + # (ssciwr/clang-tidy-wheel#30); here clang also cannot find the image's + # /usr/lib/gcc/riscv64-redhat-linux, which is not in its riscv64 triple list. + CIBW_TEST_ENVIRONMENT: CI=1 # Repeats pyproject.toml's own `environment` table: CIBW_ENVIRONMENT replaces # rather than merges with it (gotcha 107). CIBW_ENVIRONMENT: >-