-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 3.55 KB
/
Copy pathpython-tests.yml
File metadata and controls
104 lines (88 loc) · 3.55 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Test package
on:
push:
# dev is included so merges populate the branch-scoped test-data cache that
# PRs (which can only read caches from their base branch) restore from.
branches: [main, dev]
pull_request:
branches:
- main
- dev
workflow_dispatch:
jobs:
build:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
os:
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
# conftest.py skips any download whose zip already exists, so restoring
# the zips is enough; extraction is re-done cheaply per run. The key
# hashes conftest.py -- it holds the release URL and asset names, so a
# data-version bump invalidates the cache. No restore-keys on purpose:
# the zip filenames are unversioned, and a stale dnss256.zip restored
# under a new key would be silently used as current.
- name: Cache test data
uses: actions/cache@v4
with:
path: tests/.test_cache/*.zip
key: test-data-unit-${{ runner.os }}-${{ hashFiles('tests/conftest.py') }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Install the project
run: uv sync --python ${{ matrix.python-version }}
- name: Lint
run:
uv tool run ruff check --output-format=github src
- name: Run tests (skip integration)
run: uv run pytest tests -m "not integration"
integration:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
python-version: "3.12"
- os: ubuntu-latest
python-version: "3.12"
# Windows skipped: nPlayServer doesn't reliably deliver UDP
# data through the ezmsg graph on GHA runners.
# - os: windows-latest
# python-version: "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# Separate key from the unit job: this one also holds the platform
# nPlayServer zip, which would otherwise never be cached (the unit jobs
# save the shared key first, without it). Falling back to the unit key is
# safe because it carries the same conftest hash, so the restored zips
# are current and only nPlayServer is fetched on top.
- name: Cache test data
uses: actions/cache@v4
with:
path: tests/.test_cache/*.zip
key: test-data-integration-${{ runner.os }}-${{ hashFiles('tests/conftest.py') }}
restore-keys: |
test-data-unit-${{ runner.os }}-${{ hashFiles('tests/conftest.py') }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y libportaudio2
sudo sysctl -w net.core.rmem_max=8388608
- name: Allow nPlayServer through firewall (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-NetFirewallRule -DisplayName "CereLink-UDP-In" -Direction Inbound -Protocol UDP -LocalPort 51001-51002 -Action Allow
New-NetFirewallRule -DisplayName "CereLink-UDP-Out" -Direction Outbound -Protocol UDP -RemotePort 51001-51002 -Action Allow
- name: Install the project
run: uv sync --python ${{ matrix.python-version }}
- name: Run integration tests
run: uv run pytest tests -m integration -v --timeout=60