summaryrefslogtreecommitdiff
path: root/subprojects/pixpat/.github/workflows/ci.yml
blob: 3eb168a0de50aee5d5d67a6cf0f03e4d5e893944 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CI

on:
  pull_request:
    branches: [master]
  push:
    branches: [master, test]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  lint:
    name: lint (uncrustify + ruff)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: actions/setup-python@v6
        with:
          python-version: '3.x'

      - name: Install uncrustify
        run: |
          sudo apt-get update
          sudo apt-get install -y uncrustify

      - name: Install ruff
        run: pip install ruff

      - name: uncrustify --check
        run: |
          files=$(git ls-files '*.cpp' '*.h')
          uncrustify -c uncrustify.cfg -l CPP --check $files

      - name: ruff check
        run: ruff check .

      - name: ruff format --check
        run: ruff format --check .

  build:
    name: build (${{ matrix.compiler }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        compiler: [gcc, clang]
    steps:
      - uses: actions/checkout@v6

      - uses: actions/setup-python@v6
        with:
          python-version: '3.x'

      - name: Install build dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y meson ninja-build
          if [ "${{ matrix.compiler }}" = "clang" ]; then
            sudo apt-get install -y clang
          fi

      - name: Configure meson
        run: |
          if [ "${{ matrix.compiler }}" = "clang" ]; then
            export CC=clang CXX=clang++
          else
            export CC=gcc CXX=g++
          fi
          meson setup build

      - name: Compile
        run: meson compile -C build

      - name: Run native tests
        run: meson test -C build --print-errorlogs

      - name: Install pixpat wheel
        run: pip install .

      - name: Run pytest
        run: |
          pip install pytest
          pytest pixpat-python/tests