@@ -2,16 +2,123 @@ name: "Release new version"
22on :
33 workflow_run :
44 workflows :
5- - " CPP Unit Tests"
5+ - " Python Bindings Unit Tests"
66 branches :
77 - main
88 types :
99 - completed
1010
1111jobs :
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' }}
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 }}
0 commit comments