-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (80 loc) · 2.69 KB
/
Copy pathci.yml
File metadata and controls
95 lines (80 loc) · 2.69 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
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install
run: |
pip install --upgrade pip
pip install -e . pytest pytest-cov
- name: Run tests with coverage
run: pytest --cov=pilotprotocol --cov-report=term --cov-report=xml --cov-report=html
continue-on-error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: always()
with:
files: ./coverage.xml
flags: unittests
name: sdk-python
fail_ci_if_error: false
- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-sdk-python
path: |
coverage.xml
htmlcov/
retention-days: 30
if-no-files-found: ignore
# Builds libpilot from source and resolves every FFI symbol the SDK names
# against it. The rest of the suite substitutes a fake library object, so
# this is the only job that notices when the two repos drift apart.
ffi-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: sdk-python
- uses: actions/checkout@v4
with:
repository: pilot-protocol/libpilot
path: libpilot
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build libpilot
working-directory: libpilot
run: CGO_ENABLED=1 go build -buildmode=c-shared -o libpilot.so .
- name: Install SDK
working-directory: sdk-python
run: |
pip install --upgrade pip
# pytest-cov is required even though this job measures no coverage:
# pyproject's [tool.pytest.ini_options] addopts always passes --cov,
# and the run below passes --no-cov to switch it off. Without the
# plugin installed, pytest rejects both as unrecognized arguments and
# exits 4 before collecting a single test — which is why ffi-smoke
# has failed on every run since it was introduced.
pip install -e . pytest pytest-cov
- name: Resolve FFI symbols against the freshly built library
working-directory: sdk-python
env:
PILOT_LIB_PATH: ${{ github.workspace }}/libpilot/libpilot.so
PILOT_REQUIRE_LIB: '1'
run: pytest tests/test_ffi_smoke.py -v -p no:cacheprovider --no-cov