Skip to content

Commit cacd4eb

Browse files
committed
Added RiscV unit tests for python bindings (#15)
This commit adds tests on RiscV ubuntu using QEMU emulators. It also updates the release workflow to build python wheels and attach them to the release artifacts.
1 parent 604d1ac commit cacd4eb

3 files changed

Lines changed: 165 additions & 13 deletions

File tree

.github/workflows/python-bindings.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,51 @@ jobs:
8282
retention-days: 1
8383
if-no-files-found: error
8484

85-
upload-to-codecov:
86-
name: "Codecov report upload"
87-
needs: [ "python-tests" ]
88-
runs-on: ubuntu-22.04
85+
riscv-tests:
86+
name: "Build & Test on RISC-V (QEMU)"
87+
strategy:
88+
matrix:
89+
python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
90+
runs-on: ubuntu-latest
91+
92+
env:
93+
INSTALL_PREFIX: "/usr/local"
94+
PYTHON_VERSION: "${{ matrix.python }}"
95+
8996
steps:
90-
- uses: actions/checkout@v4
91-
- name: "Download artifacts"
92-
uses: actions/download-artifact@v4
93-
- name: "Upload coverage to Codecov"
94-
uses: codecov/codecov-action@v4
97+
- name: "Checkout repository"
98+
uses: actions/checkout@v4
99+
100+
- name: "Build and test inside RISC-V emulated environment (Debian based)"
101+
uses: uraimo/run-on-arch-action@v2
95102
with:
96-
fail_ci_if_error: true
97-
token: ${{ secrets.CODECOV_TOKEN }}
103+
arch: riscv64
104+
distro: ubuntu22.04
105+
githubToken: ${{ github.token }}
106+
107+
install: |
108+
apt-get update
109+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
110+
python3 python3-pip python3-venv python3-wheel python3-setuptools \
111+
g++ cmake ninja-build git xxd
112+
113+
run: |
114+
set -eux
115+
echo "Building for RISC-V on Ubuntu 22.04"
116+
117+
python3 -m pip install --upgrade pip
118+
python3 -m pip install -r build-requirements.txt
119+
120+
mkdir -p /tmp/capio_cl_jsons
121+
cp tests/jsons/*.json /tmp/capio_cl_jsons
122+
123+
python3 -m build \
124+
-Ccmake.define.ENABLE_COVERAGE=OFF \
125+
-Ccmake.build-type=Release \
126+
-Ccmake.define.CAPIO_CL_BUILD_TESTS=OFF
127+
128+
pip install dist/*.whl
129+
python3 -m pip install -r test-requirements.txt
130+
131+
echo "✅ Running unit tests"
132+
pytest -v tests/python/test_* | tee pytest-riscv.log

.github/workflows/release.yml

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,123 @@ name: "Release new version"
22
on:
33
workflow_run:
44
workflows:
5-
- "CPP Unit Tests"
5+
- "Python Bindings Unit Tests"
66
branches:
77
- main
88
types:
99
- completed
1010

1111
jobs:
12+
13+
build-macos-ubuntu-wheels:
14+
name: "Build python Wheels"
15+
strategy:
16+
matrix:
17+
os: [ 'ubuntu-latest', 'macos-latest', 'macos-15-intel' ]
18+
python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: "Set up Python"
26+
uses: actions/setup-python@v6
27+
with:
28+
python-version: ${{ matrix.python }}
29+
30+
# Install platform build dependencies
31+
- name: "Install system packages (Ubuntu)"
32+
if: startsWith(matrix.on, 'ubuntu-')
33+
run: sudo apt-get update && sudo apt-get install -y ninja-build g++ cmake
34+
35+
- name: "Setup Homebrew (macOS)"
36+
if: startsWith(matrix.on, 'macos-')
37+
uses: Homebrew/actions/setup-homebrew@main
38+
39+
- name: "Install system packages (macOS)"
40+
if: startsWith(matrix.on, 'macos-')
41+
run: brew install ninja gcc cmake
42+
43+
# Install Python build dependencies
44+
- name: "Build Python wheel"
45+
run: |
46+
mkdir -p /tmp/capio_cl_jsons
47+
cp tests/jsons/*.json /tmp/capio_cl_jsons
48+
python -m pip install --upgrade pip
49+
python -m pip install -r build-requirements.txt
50+
51+
python -m build \
52+
-Ccmake.define.ENABLE_COVERAGE=ON \
53+
-Ccmake.build-type=Debug \
54+
-Ccmake.define.CAPIO_CL_BUILD_TESTS=OFF
55+
56+
mv dist/*.whl dist/py_capio_cl_${{matrix.os}}_python_${{matrix.python}}.whl
57+
58+
- name: "Upload artifact"
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: ${{ format('py_capio_cl_{0}_python_{1}.whl', matrix.os, matrix.python) }}
62+
path: "dist/${{ format('py_capio_cl_{0}_python_{1}.whl', matrix.os, matrix.python) }}"
63+
retention-days: 1
64+
if-no-files-found: error
65+
66+
riscv-wheels:
67+
name: "Build RiscV Ubuntu python wheels"
68+
runs-on: ubuntu-latest
69+
strategy:
70+
matrix:
71+
python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
72+
73+
env:
74+
INSTALL_PREFIX: "/usr/local"
75+
PYTHON_VERSION: "${{ matrix.python }}"
76+
77+
steps:
78+
- name: "Checkout repository"
79+
uses: actions/checkout@v4
80+
81+
- name: "Build and test inside RISC-V emulated environment (Debian based)"
82+
uses: uraimo/run-on-arch-action@v2
83+
with:
84+
arch: riscv64
85+
distro: ubuntu22.04
86+
githubToken: ${{ github.token }}
87+
88+
install: |
89+
apt-get update
90+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
91+
python3 python3-pip python3-venv python3-wheel python3-setuptools \
92+
g++ cmake ninja-build git xxd
93+
94+
run: |
95+
set -eux
96+
echo "Building for RISC-V on Ubuntu 22.04"
97+
98+
python3 -m pip install --upgrade pip
99+
python3 -m pip install -r build-requirements.txt
100+
101+
mkdir -p /tmp/capio_cl_jsons
102+
cp tests/jsons/*.json /tmp/capio_cl_jsons
103+
104+
python3 -m build \
105+
-Ccmake.define.ENABLE_COVERAGE=OFF \
106+
-Ccmake.build-type=Release \
107+
-Ccmake.define.CAPIO_CL_BUILD_TESTS=OFF
108+
109+
mv dist/*.whl dist/py_capio_cl_ubunturv64_python_${{matrix.python}}.whl
110+
111+
- name: "Upload built RISC-V wheel"
112+
if: success()
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: "${{ format('py_capio_cl_ubunturv64_python_{0}.whl', matrix.python) }}"
116+
path: "dist/${{ format('py_capio_cl_ubunturv64_python_{0}.whl', matrix.python) }}"
117+
12118
github:
13119
name: "Create GitHub Release"
14-
runs-on: ubuntu-22.04
120+
needs: [ riscv-wheels, build-macos-ubuntu-wheels ]
121+
runs-on: ubuntu-latest
15122
permissions:
16123
contents: write
17124
if: ${{ github.event.workflow_run.conclusion == 'success' }}
@@ -28,6 +135,10 @@ jobs:
28135
with:
29136
tag: ${{ env.CAPIO_CL_VERSION }}
30137

138+
- name: "Download built wheel artifacts"
139+
uses: actions/download-artifact@v4
140+
with:
141+
path: dist
31142

32143
- name: "Create GitHub Release"
33144
if: ${{ steps.check-tag.outputs.exists == 'false' }}
@@ -36,5 +147,6 @@ jobs:
36147
name: "v${{ env.CAPIO_CL_VERSION }}"
37148
tag_name: "v${{ env.CAPIO_CL_VERSION }}"
38149
generate_release_notes: true
150+
files: dist/*.whl
39151
env:
40152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
![Ubuntu](https://img.shields.io/badge/Ubuntu-121212?logo=ubuntu&logoColor=E95420)
1414
![macOS](https://img.shields.io/badge/macOS-121212?logo=apple&logoColor=white)
1515

16+
![Intel](https://img.shields.io/badge/Intel-121212?logo=intel&logoColor=0071C5)
17+
![ARM](https://img.shields.io/badge/ARM-121212?logo=arm&logoColor=0091BD)
18+
![RISC-V](https://img.shields.io/badge/RISC--V-121212?logo=riscv&logoColor=F9A825)
19+
20+
1621
[![DOI](https://img.shields.io/badge/DOI-10.1007%2Fs10766--025--00789--0-%23cc5500?logo=doi&logoColor=white&labelColor=2b2b2b)](https://doi.org/10.1007/s10766-025-00789-0)
1722

1823
**CAPIO-CL** is a novel I/O coordination language that enables users to annotate file-based workflow data dependencies

0 commit comments

Comments
 (0)