|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: main |
| 6 | + paths-ignore: |
| 7 | + - '.gitignore' |
| 8 | + - 'LICENSE' |
| 9 | + - 'README' |
| 10 | + - '.pre-commit-config.yaml' |
| 11 | + pull_request: |
| 12 | + branches: main |
| 13 | + paths-ignore: |
| 14 | + - '.gitignore' |
| 15 | + - 'LICENSE' |
| 16 | + - 'README' |
| 17 | + - '.pre-commit-config.yaml' |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +jobs: |
| 21 | + lint: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + permissions: |
| 24 | + contents: read |
| 25 | + timeout-minutes: 10 |
| 26 | + steps: |
| 27 | + # 6.0.2 |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 30 | + with: |
| 31 | + persist-credentials: false |
| 32 | + |
| 33 | + - name: Install uv |
| 34 | + # 7.2.0 |
| 35 | + uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b |
| 36 | + with: |
| 37 | + version: "0.9.21" |
| 38 | + enable-cache: true |
| 39 | + save-cache: ${{ github.ref == 'refs/heads/main' }} |
| 40 | + cache-dependency-glob: | |
| 41 | + **/uv.lock |
| 42 | + **/pyproject.toml |
| 43 | +
|
| 44 | + - name: Install python dependencies |
| 45 | + run: uv sync --all-extras --all-groups --frozen |
| 46 | + |
| 47 | + - name: Check Python code formatting |
| 48 | + run: uv run ruff format --check |
| 49 | + |
| 50 | + - name: Check Python code lint |
| 51 | + run: uv run ruff check --output-format=github |
| 52 | + |
| 53 | + - name: Check Python code types |
| 54 | + run: uv run mypy . |
| 55 | + |
| 56 | + - name: Run tests |
| 57 | + run: uv run pytest |
| 58 | + |
| 59 | + build: |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + os: ['ubuntu-24.04', 'ubuntu-24.04-arm'] |
| 63 | + compiler: ['gcc', 'clang'] |
| 64 | + runs-on: ${{ matrix.os }} |
| 65 | + container: |
| 66 | + image: ubuntu:26.04 |
| 67 | + options: --privileged |
| 68 | + permissions: |
| 69 | + contents: read |
| 70 | + timeout-minutes: 20 |
| 71 | + env: |
| 72 | + CC: ${{ matrix.compiler }} |
| 73 | + BUILDDIR: builddir |
| 74 | + CONFIG_OPTS: -Dtests=true |
| 75 | + MESON_TEST_TIMEOUT_MULTIPLIER: 2 |
| 76 | + DEBIAN_FRONTEND: noninteractive |
| 77 | + steps: |
| 78 | + - name: Install dependencies |
| 79 | + run: apt-get update && apt-get install -y git findutils |
| 80 | + |
| 81 | + - name: Set git safe directory |
| 82 | + run: git config --global safe.directory "*" |
| 83 | + |
| 84 | + # 6.0.2 |
| 85 | + - name: Checkout repository |
| 86 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 87 | + with: |
| 88 | + persist-credentials: false |
| 89 | + |
| 90 | + - name: Install build dependencies |
| 91 | + run: | |
| 92 | + apt-get install -y ${{ matrix.compiler }} uncrustify \ |
| 93 | + $(xargs < .github/dependencies.apt.txt) |
| 94 | +
|
| 95 | + - name: Run uncrustify |
| 96 | + run: ./uncrustify.sh && git diff --exit-code |
| 97 | + |
| 98 | + - name: Configure with meson |
| 99 | + run: | |
| 100 | + if [ "${{ matrix.compiler }}" = "gcc" ]; then |
| 101 | + SANITIZE_OPTS="-Db_sanitize=address,undefined" |
| 102 | + else |
| 103 | + SANITIZE_OPTS="" |
| 104 | + fi |
| 105 | +
|
| 106 | + meson setup --wrap-mode nodownload ${CONFIG_OPTS} \ |
| 107 | + -Dwerror=true ${SANITIZE_OPTS} ${BUILDDIR} . |
| 108 | +
|
| 109 | + - name: Build with meson |
| 110 | + run: meson compile -C ${BUILDDIR} |
| 111 | + |
| 112 | + - name: Run tests with Meson |
| 113 | + env: |
| 114 | + ASAN_OPTIONS: "detect_leaks=1:fast_unwind_on_malloc=0:malloc_context_size=20:symbolize=1" |
| 115 | + UBSAN_OPTIONS: "print_stacktrace=1" |
| 116 | + run: | |
| 117 | + export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/tests/lsan.supp" |
| 118 | + meson test -C ${BUILDDIR} --verbose --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} |
| 119 | +
|
| 120 | + - name: Upload test logs |
| 121 | + # 7.0.0 |
| 122 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f |
| 123 | + if: failure() || cancelled() |
| 124 | + with: |
| 125 | + name: test logs |
| 126 | + path: | |
| 127 | + builddir/meson-logs/testlog.txt |
| 128 | + installed-test-logs/ |
| 129 | +
|
| 130 | + - name: Create dist tarball |
| 131 | + run: | |
| 132 | + meson setup --wrap-mode nodownload --reconfigure ${CONFIG_OPTS} ${BUILDDIR}_dist . |
| 133 | + meson dist --include-subprojects -C ${BUILDDIR}_dist |
0 commit comments