| name: Libclang Python Binding Tests |
| |
| permissions: |
| contents: read |
| |
| on: |
| push: |
| branches: |
| - 'main' |
| paths: |
| - 'clang/bindings/python/**' |
| - 'clang/tools/libclang/**' |
| - 'clang/CMakeList.txt' |
| - '.github/workflows/libclang-python-tests.yml' |
| pull_request: |
| paths: |
| - 'clang/bindings/python/**' |
| - 'clang/tools/libclang/**' |
| - 'clang/CMakeList.txt' |
| - '.github/workflows/libclang-python-tests.yml' |
| |
| jobs: |
| check-clang-python: |
| # Build libclang and then run the libclang Python binding's unit tests. |
| # There is an issue running on "windows-2019". |
| # See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082. |
| name: Build and run Python unit tests |
| if: github.repository == 'llvm/llvm-project' |
| runs-on: ubuntu-24.04 |
| strategy: |
| fail-fast: false |
| matrix: |
| python-version: ["3.8", "3.13"] |
| steps: |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| with: |
| persist-credentials: false |
| - name: Setup Python |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| with: |
| persist-credentials: false |
| python-version: ${{ matrix.python-version }} |
| - name: Setup ccache |
| uses: hendrikmuhs/ccache-action@33522472633dbd32578e909b315f5ee43ba878ce # v1.2.22 |
| with: |
| max-size: 2G |
| key: spirv-ubuntu-24.04 |
| variant: sccache |
| - name: Build and Test |
| run: | |
| mkdir build |
| cmake -GNinja \ |
| -S llvm \ |
| -B build \ |
| -DCMAKE_BUILD_TYPE=Release \ |
| -DLLVM_ENABLE_ASSERTIONS=ON \ |
| -DCMAKE_C_COMPILER_LAUNCHER=sccache \ |
| -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ |
| -DLLVM_ENABLE_PROJECTS=clang |
| ninja -C build check-clang-python |