-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (115 loc) · 4.35 KB
/
python-bindings.yml
File metadata and controls
139 lines (115 loc) · 4.35 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
name: "Python Bindings Unit Tests"
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: build-python-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
python-tests:
name: "Test Python bindings"
strategy:
matrix:
on: [ 'ubuntu-24.04', 'macos-15-intel', 'macos-26' ]
python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
runs-on: ${{ matrix.on }}
env:
INSTALL_PREFIX: "/usr/local"
steps:
- name: "Checkout repository"
uses: actions/checkout@v6
- name: "Set up Python ${{ matrix.python }}"
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
# Install platform build dependencies
- name: "Install system packages (Ubuntu)"
if: startsWith(matrix.on, 'ubuntu-')
run: sudo apt-get update && sudo apt-get install -y ninja-build g++ cmake libcurl4-gnutls-dev
- name: "Setup Homebrew (macOS)"
if: startsWith(matrix.on, 'macos-')
uses: Homebrew/actions/setup-homebrew@main
- name: "Install system packages (macOS)"
if: startsWith(matrix.on, 'macos-')
run: brew install ninja gcc cmake curl
- name: "Create virtual environment"
run: |
pip install -r build-requirements.txt
pip install -r test-requirements.txt
# Install Python build dependencies
- name: "Build and Install Python package"
run: |
mkdir -p /tmp/capio_cl_jsons
mkdir -p /tmp/capio_cl_tomls
cp -r tests/jsons/* /tmp/capio_cl_jsons
cp -r tests/tomls/* /tmp/capio_cl_tomls
pip install .
# Run unit tests
- name: "Run Python tests (Ubuntu)"
if: startsWith(matrix.on, 'ubuntu-')
run: |
pytest -v tests/python/test_*
- name: "Run Python tests (MacOS)"
if: startsWith(matrix.on, 'macos-')
run: |
pytest -k "not test_home_node" -v tests/python/test_*
- name: "Generate coverage report"
if: ${{ startsWith(matrix.on, 'ubuntu-') }}
run: |
pip install --upgrade gcovr
gcovr \
--exclude-throw-branches \
--gcov-ignore-parse-errors=negative_hits.warn \
--exclude tests/ \
--xml coverage.xml \
.
- name: "Upload coverage report"
if: ${{ startsWith(matrix.on, 'ubuntu-') }}
uses: actions/upload-artifact@v7
with:
name: ${{ format('{0}-{1}-tests', matrix.on, matrix.python) }}
path: ./coverage.xml
retention-days: 1
if-no-files-found: error
riscv-tests:
name: "Build & Test on RISC-V (QEMU)"
strategy:
matrix:
python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
runs-on: ubuntu-latest
env:
INSTALL_PREFIX: "/usr/local"
PYTHON_VERSION: "${{ matrix.python }}"
steps:
- name: "Checkout repository"
uses: actions/checkout@v6
- name: "Build and test inside RISC-V emulated environment (Debian based)"
uses: uraimo/run-on-arch-action@v3
with:
arch: riscv64
distro: ubuntu_latest
githubToken: ${{ github.token }}
install: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3 python3-pip python3-venv python3-wheel python3-setuptools \
g++ cmake ninja-build git
run: |
set -eux
echo "Building for RISC-V on Ubuntu 22.04"
python3 -m pip install -r build-requirements.txt --break-system-packages
mkdir -p /tmp/capio_cl_jsons
mkdir -p /tmp/capio_cl_tomls
cp -r tests/jsons/* /tmp/capio_cl_jsons
cp -r tests/tomls/* /tmp/capio_cl_tomls
python3 -m build \
-Ccmake.define.ENABLE_COVERAGE=OFF \
-Ccmake.build-type=Release \
-Ccmake.define.CAPIO_CL_BUILD_TESTS=OFF
pip install dist/*.whl --break-system-packages
python3 -m pip install -r test-requirements.txt --break-system-packages
pytest -v tests/python/test_* | tee pytest-riscv.log