aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/libclang-python-tests.yml
blob: 0d66f5d595e0ec43ed99b9a4d685507227c1d680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - name: Setup Python
        uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
        with:
          python-version: ${{ matrix.python-version }}
      - name: Setup ccache
        uses: hendrikmuhs/ccache-action@bfa03e1de4d7f7c3e80ad9109feedd05c4f5a716 # v1.2.19
        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