-
Notifications
You must be signed in to change notification settings - Fork 27
141 lines (122 loc) · 4.23 KB
/
Copy pathtest.yml
File metadata and controls
141 lines (122 loc) · 4.23 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Tests
on:
push:
branches:
- 'master'
- 'releases/**'
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["release", "workflow_dispatch"]'
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v3
with:
args: check
src: pycbsdk/src
- uses: astral-sh/ruff-action@v3
with:
args: format --check
src: pycbsdk/src
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {name: "windows-x64", os: "windows-2022", cmake_extra: "-T v142,host=x86"}
- {name: "macOS-latest", os: "macOS-latest"}
- {name: "ubuntu-latest", os: "ubuntu-latest"}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # setuptools-scm needs tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install 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
# Single build: tests + shared library
- name: Configure
run: |
cmake -B build -S . \
-DCBSDK_BUILD_CBMEX=OFF \
-DCBSDK_BUILD_CBOCT=OFF \
-DCBSDK_BUILD_TEST=ON \
-DCBSDK_BUILD_SAMPLE=OFF \
-DCBSDK_BUILD_SHARED=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
${{ matrix.config.cmake_extra }}
- name: Build
run: cmake --build build --config Release -j
# C++ unit tests (fast, no device needed)
- name: Unit Tests
run: >
ctest --test-dir build --build-config Release --output-on-failure
-E "^(device|integration)\."
- name: Allow nPlayServer through firewall (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Allow UDP on nPlayServer ports for both nPlayServer and the test executables
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
# C++ integration tests (nPlayServer downloaded at configure time)
# Skipped on Windows: nPlayServer launched via CreateProcessA doesn't
# reliably bind UDP ports on GHA runners (investigating).
- name: Integration Tests
if: runner.os != 'Windows'
run: >
ctest --test-dir build --build-config Release --output-on-failure
--timeout 30
-R "^integration\."
timeout-minutes: 10
# pycbsdk tests (reuse the shared library from the same build)
- name: Install shared library
run: cmake --install build --config Release
- name: Set library path
shell: python
run: |
import os, pathlib
workspace = pathlib.Path(os.environ["GITHUB_WORKSPACE"])
libdir = workspace / "install" / ("bin" if os.name == "nt" else "lib")
with open(os.environ["GITHUB_ENV"], "a") as f:
f.write(f"CBSDK_LIB_DIR={libdir}\n")
- name: Install pycbsdk
working-directory: pycbsdk
run: uv sync
- name: pycbsdk Tests
working-directory: pycbsdk
run: uv run pytest tests/ -m integration --timeout=120 -v
timeout-minutes: 10