Skip to content

Commit 4c6197f

Browse files
authored
CI: Linux on ARM64, other Pythons, Enterprise Linux 8 and 9 (#33)
* CI: Linux on ARM64, other Pythons, Enterprise Linux 8 and 9 - ubuntu-24.04-arm with NVC built from its release, which has no ARM64 package - The Python of Ubuntu, of uv and of pyenv, besides python.org's - AlmaLinux 8 and 9 containers with the Python, gcc and LLVM of the distribution, NVC built from its release; EL8 has the oldest toolchain
1 parent b0a35e9 commit 4c6197f

2 files changed

Lines changed: 129 additions & 6 deletions

File tree

‎.github/workflows/python_bridge.yml‎

Lines changed: 127 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: 'python bridge'
22

33
# Tests of the vunit-python-bridge package on CPython from python.org: Linux
4-
# and macOS (bridge compiled on first use), Windows (prebuilt MSVC DLLs, and
4+
# and macOS (bridge compiled on first use), Linux on ARM64, Linux with the Pythons
5+
# of the distribution, uv and pyenv, Enterprise Linux 8 and 9, Windows (prebuilt MSVC DLLs, and
56
# a gcc build without them), the Python unit tests, the content of the
67
# distribution, and the built wheel installed on every kind of system.
78

@@ -55,6 +56,8 @@ jobs:
5556
- { os: ubuntu-24.04, py: '3.14', sim: ghdl, backend: gcc, ghdl: latest }
5657
- { os: ubuntu-24.04, py: '3.15', sim: ghdl, backend: gcc, ghdl: latest }
5758
- { os: ubuntu-24.04, py: '3.14', sim: ghdl, backend: gcc, ghdl: nightly, canary: true }
59+
# Linux on ARM64: no NVC package exists for it, so NVC is built from its release
60+
- { os: ubuntu-24.04-arm, py: '3.14', sim: nvc, nvc: '1.22.1' }
5861
- { os: macos-15, py: '3.14', sim: nvc, nvc: brew }
5962
- { os: macos-15, py: '3.15', sim: nvc, nvc: brew }
6063
# macos-15: setup-ghdl has no build for newer macOS versions yet, and only the llvm backend
@@ -75,17 +78,18 @@ jobs:
7578
python-version: ${{ matrix.py }}
7679

7780
- name: '⚙️ Setup NVC'
78-
if: matrix.sim == 'nvc' && matrix.nvc != 'brew' && matrix.nvc != 'master'
81+
if: matrix.sim == 'nvc' && matrix.nvc != 'brew' && matrix.nvc != 'master' && runner.arch == 'X64'
7982
run: |
8083
curl -fsSL -o nvc.deb "https://github.com/nickg/nvc/releases/download/r${{ matrix.nvc }}/nvc_${{ matrix.nvc }}-1_amd64_ubuntu-24.04.deb"
8184
sudo apt-get install -y ./nvc.deb
8285
83-
# As in NVC's README
84-
- name: '⚙️ Build NVC from its master branch'
85-
if: matrix.nvc == 'master'
86+
# As in NVC's README: its master branch, or its release on ARM64, which has no package
87+
- name: '⚙️ Build NVC from source'
88+
if: matrix.nvc == 'master' || (matrix.sim == 'nvc' && runner.os == 'Linux' && runner.arch == 'ARM64')
8689
run: |
8790
sudo apt-get install -y -qq build-essential automake autoconf flex check llvm-dev pkg-config zlib1g-dev libdw-dev libffi-dev libzstd-dev
88-
git clone --depth 1 https://github.com/nickg/nvc.git "$RUNNER_TEMP/nvc"
91+
ref=${{ matrix.nvc == 'master' && 'master' || format('r{0}', matrix.nvc) }}
92+
git clone --depth 1 --branch "$ref" https://github.com/nickg/nvc.git "$RUNNER_TEMP/nvc"
8993
cd "$RUNNER_TEMP/nvc" && ./autogen.sh && mkdir build && cd build && ../configure && make -j"$(nproc)" && sudo make install
9094
nvc --version
9195
@@ -119,6 +123,123 @@ jobs:
119123
- name: '🚧 Example'
120124
run: python examples/embedded_python/run.py -p 4 --without-attributes .optional_deps --without-attributes .expected_failure
121125

126+
#
127+
# Linux with the Pythons users have besides python.org's: the one of the distribution
128+
# (libpython in the multiarch directory), the one uv installs (python-build-standalone)
129+
# and the one pyenv builds from source
130+
#
131+
132+
pythons:
133+
runs-on: ubuntu-24.04
134+
strategy:
135+
fail-fast: false
136+
matrix:
137+
python: [apt, uv, pyenv]
138+
name: 'ubuntu-24.04 · Python from ${{ matrix.python }} · nvc'
139+
env:
140+
VUNIT_SIMULATOR: nvc
141+
steps:
142+
143+
- name: '🧰 Checkout'
144+
uses: actions/checkout@v4
145+
146+
- name: '⚙️ Setup NVC'
147+
run: |
148+
curl -fsSL -o nvc.deb "https://github.com/nickg/nvc/releases/download/r1.22.1/nvc_1.22.1-1_amd64_ubuntu-24.04.deb"
149+
sudo apt-get install -y ./nvc.deb
150+
151+
- name: '⚙️ Setup uv'
152+
if: matrix.python == 'uv'
153+
uses: astral-sh/setup-uv@v10.3.0
154+
155+
# The path of the Python goes to PY
156+
- name: '🐍 Install Python with ${{ matrix.python }}'
157+
run: |
158+
case '${{ matrix.python }}' in
159+
apt)
160+
sudo apt-get install -y -qq python3-dev python3-venv
161+
echo "PY=/usr/bin/python3" >> "$GITHUB_ENV" ;;
162+
uv)
163+
uv python install 3.13
164+
echo "PY=$(uv python find --managed-python 3.13)" >> "$GITHUB_ENV" ;;
165+
pyenv)
166+
sudo apt-get install -y -qq libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libffi-dev liblzma-dev
167+
git clone --depth 1 https://github.com/pyenv/pyenv.git "$RUNNER_TEMP/pyenv"
168+
PYENV_ROOT="$RUNNER_TEMP/pyenv" "$RUNNER_TEMP/pyenv/bin/pyenv" install 3.13
169+
echo "PY=$(ls -d "$RUNNER_TEMP"/pyenv/versions/3.13*/bin/python3)" >> "$GITHUB_ENV" ;;
170+
esac
171+
172+
# As on python.org's Python: outside the checkout, with a space in the path
173+
- name: '🐍 Install the package in a virtual environment'
174+
run: |
175+
"$PY" -m venv "$RUNNER_TEMP/venv with space"
176+
echo "$RUNNER_TEMP/venv with space/bin" >> "$GITHUB_PATH"
177+
"$RUNNER_TEMP/venv with space/bin/pip" install -e . pytest --progress-bar off
178+
179+
- name: '🚧 Python unit tests'
180+
run: python -m pytest tests/test_python_bridge.py
181+
182+
- name: '🚧 Feature tests'
183+
run: python tests/run.py -p 4 -o "$RUNNER_TEMP/out dir"
184+
185+
- name: '🚧 Example'
186+
run: python examples/embedded_python/run.py -p 4 --without-attributes .optional_deps --without-attributes .expected_failure
187+
188+
#
189+
# Enterprise Linux, the Python and the gcc of the distribution: EL8 is the oldest
190+
# toolchain supported (gcc 8, binutils 2.30). NVC has no packages for it, so it is
191+
# built from its release with the LLVM of the distribution.
192+
#
193+
194+
el:
195+
runs-on: ubuntu-24.04
196+
container: almalinux:${{ matrix.el }}
197+
strategy:
198+
fail-fast: false
199+
matrix:
200+
# The default Python of EL8 (3.6) and EL9 (3.9) is older than the oldest supported
201+
include:
202+
- { el: 8, py: python3.11 }
203+
- { el: 9, py: python3.12 }
204+
name: 'AlmaLinux ${{ matrix.el }} · ${{ matrix.py }} · nvc'
205+
env:
206+
VUNIT_SIMULATOR: nvc
207+
steps:
208+
209+
- name: '⚙️ Install the Python and the build tools of the distribution'
210+
run: |
211+
dnf install -y -q ${{ matrix.py }} ${{ matrix.py }}-devel gcc gcc-c++ make git tar which \
212+
llvm-devel zlib-devel elfutils-devel libffi-devel libzstd-devel flex bison
213+
214+
- name: '🧰 Checkout'
215+
uses: actions/checkout@v4
216+
217+
- name: '⚙️ Build NVC'
218+
run: |
219+
curl -fsSL https://github.com/nickg/nvc/releases/download/r1.22.1/nvc-1.22.1.tar.gz | tar xz -C "$RUNNER_TEMP"
220+
mkdir "$RUNNER_TEMP/nvc-1.22.1/build"
221+
cd "$RUNNER_TEMP/nvc-1.22.1/build"
222+
../configure -q
223+
make -j"$(nproc)" -s
224+
make -s install
225+
nvc --version
226+
227+
# As on Ubuntu: outside the checkout, with a space in the path
228+
- name: '🐍 Install the package in a virtual environment'
229+
run: |
230+
${{ matrix.py }} -m venv "$RUNNER_TEMP/venv with space"
231+
echo "$RUNNER_TEMP/venv with space/bin" >> "$GITHUB_PATH"
232+
"$RUNNER_TEMP/venv with space/bin/pip" install -e . pytest --progress-bar off
233+
234+
- name: '🚧 Python unit tests'
235+
run: python -m pytest tests/test_python_bridge.py
236+
237+
- name: '🚧 Feature tests'
238+
run: python tests/run.py -p 4 -o "$RUNNER_TEMP/out dir"
239+
240+
- name: '🚧 Example'
241+
run: python examples/embedded_python/run.py -p 4 --without-attributes .optional_deps --without-attributes .expected_failure
242+
122243
#
123244
# Windows, prebuilt MSVC DLLs, and a gcc build without them
124245
#

‎tests/test_python_bridge.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,8 @@ def test_library_exports_exactly_the_contract(self):
825825
exported.add(fields[-1][1:] if darwin and fields[-1].startswith("_") else fields[-1])
826826
# -fvisibility=hidden plus VPY_EXPORT: only the contract is exported,
827827
# no bridge internals (vpy_initialize, vpy_set_error, ...) leak out.
828+
# Older binutils (EL8) also list the symbols the linker defines in every library.
829+
exported -= {"_edata", "_end", "__bss_start"}
828830
self.assertEqual(exported, set(EXPECTED_EXPORTS))
829831

830832
def _fake_simulator_prefix(self):

0 commit comments

Comments
 (0)