diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25eba4f..b9fe77a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,10 +113,18 @@ jobs: else docker build --build-arg BASEOS=slim-bullseye --build-arg PLATFORM=manylinux -f .github/workflows/Dockerfile . fi + - name: Set artifact name + id: set_artifact_name + shell: bash -l {0} + run: | + VALUE="archive_wheels_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.skip }}" + VALUE="${VALUE//\*/}" + echo "value=${VALUE}" >> ${GITHUB_OUTPUT} - uses: actions/upload-artifact@v4 if: (!matrix.use_qemu) || fromJSON(env.USE_QEMU) with: path: ./wheelhouse/*.whl + name: ${{ steps.set_artifact_name.outputs.value }} build-sdist: name: Build source distribution @@ -137,6 +145,7 @@ jobs: - uses: actions/upload-artifact@v4 with: path: dist/*.tar.gz + name: archive_sdist test-sdist: name: Test build from source distribution @@ -151,9 +160,9 @@ jobs: with: python-version: '3.9' - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: artifact + name: archive_sdist path: sdist - name: Install from SDist @@ -177,10 +186,11 @@ jobs: if: github.repository_owner == 'ssciwr' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: artifact + pattern: archive* path: dist + merge-multiple: true - name: Upload to PyPI uses: pypa/gh-action-pypi-publish@v1.8.11 diff --git a/README.md b/README.md index 6bfd7e3..0d73bbe 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,8 @@ This repository extends the great work of several other projects: * The CI build process is controlled by [cibuildwheel](https://github.com/pypa/cibuildwheel) which makes building wheels across a number of platforms a pleasant experience (!) We are grateful for the generous provisioning with CI resources that GitHub currently offers to Open Source projects. + +## Troubleshooting + +To see which clang-tidy binary the package is using +you can set `CLANG_TIDY_WHEEL_VERBOSE` to `1` in your environment. diff --git a/clang_tidy/__init__.py b/clang_tidy/__init__.py index d5d33eb..c4dac31 100644 --- a/clang_tidy/__init__.py +++ b/clang_tidy/__init__.py @@ -3,6 +3,7 @@ from pathlib import Path import functools import pkg_resources +import os @functools.lru_cache(maxsize=None) @@ -11,7 +12,8 @@ def _get_executable(name:str) -> Path: for s in ("", ".exe", ".bin", ".dmg")] for exe in possibles: if exe.exists(): - print(f'Resource filename: {exe} ') + if os.environ.get("CLANG_TIDY_WHEEL_VERBOSE", None): + print(f'Found binary: {exe} ') return exe raise FileNotFoundError(f"No executable found for {name} at\n{possibles}") diff --git a/test/test_executable.py b/test/test_executable.py index 36f8317..abdbd93 100644 --- a/test/test_executable.py +++ b/test/test_executable.py @@ -19,12 +19,14 @@ def ensure_tidy_from_wheel(monkeypatch): monkeypatch.delitem(sys.modules, "clang_tidy", raising=False) -def test_executable_file(): +def test_executable_file(capsys): import clang_tidy + clang_tidy._get_executable.cache_clear() exe = clang_tidy._get_executable("clang-tidy") assert os.path.exists(exe) assert os.access(exe, os.X_OK) + assert capsys.readouterr().out == "" def _test_code(code: str): @@ -40,6 +42,15 @@ def _test_code(code: str): os.remove(compilation_unit) +def test_verbose_output(capsys, monkeypatch): + import clang_tidy + monkeypatch.setenv("CLANG_TIDY_WHEEL_VERBOSE", "1") + # need to clear cache to make sure the function is run again + clang_tidy._get_executable.cache_clear() + clang_tidy._get_executable("clang-tidy") + assert capsys.readouterr().out + + @pytest.mark.skipif( os.environ.get("CI", None) and "linux" in sys.platform, reason="https://github.com/ssciwr/clang-tidy-wheel/issues/30",