Debian Codegraph @

.github/workflows/test.yml

raw
1 name: Test
2
3 on:
4 push:
5 branches: [ main ]
6 pull_request:
7 workflow_dispatch:
8
9 # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise
10 concurrency:
11 group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}
12 cancel-in-progress: true
13
14 defaults:
15 run:
16 shell: bash
17
18 jobs:
19 test:
20 name: ${{ matrix.os }} - ${{ matrix.py }}
21 runs-on: ${{ matrix.os }}
22 env:
23 motherduck_token: ${{ secrets.HARLEQUIN_MOTHERDUCK_TOKEN }}
24 strategy:
25 fail-fast: false
26 matrix:
27 os:
28 - ubuntu-latest
29 - MacOs-latest
30 - Windows-latest
31 py:
32 - "3.14"
33 - "3.13"
34 - "3.12"
35 - "3.11"
36 - "3.10"
37 steps:
38 - name: Check out Repo
39 uses: actions/checkout@v7
40 with:
41 persist-credentials: false
42
43 - name: Set up Python ${{ matrix.py }}
44 id: setup-python
45 uses: actions/setup-python@v7
46 with:
47 python-version: ${{ matrix.py }}
48
49 - name: Install uv
50 uses: astral-sh/[email protected]
51 with:
52 version: "0.12.8"
53 python-version: ${{ matrix.py }}
54 enable-cache: true
55
56 - name: Install python dependencies
57 run: |
58 uv sync --locked --group test
59
60 # Windows runners ship without a timezone database, so the test session
61 # downloads one into a shared user data directory. Do it once, up front:
62 # xdist workers would otherwise race to download and extract it.
63 - name: Install timezone database
64 if: matrix.os == 'Windows-latest'
65 run: |
66 uv run --no-sync python -c "from harlequin.windows_timezone import check_and_install_tzdata; check_and_install_tzdata()"
67
68 - name: Run tests
69 run: |
70 uv run --no-sync pytest -m "not online" ${{ matrix.os == 'Windows-latest' && '--force-flaky --max-runs=3' || '' }} --snapshot-warn-unused
71
72 - name: Store snapshot report on failure
73 uses: actions/upload-artifact@v7
74 if: failure()
75 with:
76 name: Snapshot Report ${{ matrix.os }} ${{ matrix.py }}
77 path: ./snapshot_report.html