Skip to content

Commit 2942428

Browse files
committed
Upgrade to v8 13.2 and use native aarch64 runners
1 parent cbe0447 commit 2942428

File tree

7 files changed

+44
-41
lines changed

7 files changed

+44
-41
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,44 +32,36 @@ jobs:
3232
- name: Build
3333
run: python -m build --sdist
3434

35-
- uses: actions/upload-artifact@v3
35+
- uses: actions/upload-artifact@v4
3636
with:
3737
name: sdist
3838
path: dist/*
3939
if-no-files-found: error
4040

4141
# We build for Linux using uraimo/run-on-arch-action@v2, which runs a container under
4242
# the runner in order to reach different platforms (notably Alpine with its musl) and
43-
# architectures (notably aarch64) via emulation. uraimo/run-on-arch-action@v2 doesn't
44-
# support Mac or Windows, so we run a separate job for those.
43+
# architectures. uraimo/run-on-arch-action@v2 doesn't support Mac or Windows, so we
44+
# run a separate job for those.
4545
linux-wheels:
46-
name: Build wheel for ${{ matrix.image }}
47-
runs-on: ubuntu-latest
46+
name: Build wheel for ${{ matrix.config.image }} on ${{ matrix.config.os }}
47+
runs-on: ${{ matrix.config.os }}
4848
strategy:
4949
fail-fast: false
5050
matrix:
51-
image:
51+
config:
5252
# To maximize compatibility of generated wheels, we should theoreticaly build
5353
# on the *oldest* supported distros.
5454
# But V8 ships its own bullseye sysroot and links against that, so we may as
5555
# well run on bullseye (even though buster would provide an older supported
5656
# build distro):
57-
- debian:bullseye
58-
- arm64v8/debian:bullseye
59-
# Alpine 3.19 includes a clang new enough for V8 to build (with only minor
60-
# patches!). Builds on 3.19 seem incompatible with <= 3.18 due to libstdc++
61-
# symbols. (And we can't just run on an old Alpine and update clang from the
62-
# llvm site, because unlike Debian, the llvm project doesn't maintain
63-
# updated packages for old Alpine distros.)
64-
- alpine:3.19
65-
- arm64v8/alpine:3.19
66-
exclude:
67-
# The aarch64 builds run really slowly, so let's skip them except for
68-
# releases.
69-
# For more info on this GitHub Actions hack, see:
70-
# https://stackoverflow.com/questions/65384420/how-do-i-make-a-github-action-matrix-element-conditional#answer-73822998
71-
- image: ${{ !startsWith(github.ref, 'refs/heads/release/') && 'arm64v8/debian:bullseye' }}
72-
- image: ${{ !startsWith(github.ref, 'refs/heads/release/') && 'arm64v8/alpine:3.19' }}
57+
- os: ubuntu-latest # x86_64 base OS (on which we run a container)
58+
image: bullseye
59+
- os: ubuntu-latest
60+
image: arm64v8/alpine:3.19
61+
- os: ubuntu-24.04-arm
62+
image: arm64v8/bullseye
63+
- os: ubuntu-24.04-arm
64+
image: arm64v8/alpine:3.19
7365

7466
steps:
7567
- name: Configure git
@@ -90,7 +82,7 @@ jobs:
9082
with:
9183
arch: none
9284
distro: none
93-
base_image: ${{ matrix.image }}
85+
base_image: ${{ matrix.config.image }}
9486

9587
setup: |
9688
mkdir -p "${PWD}/wheels"
@@ -101,7 +93,7 @@ jobs:
10193
shell: /bin/sh
10294

10395
install: |
104-
case "${{ matrix.image }}" in
96+
case "${{ matrix.config.image }}" in
10597
*debian*)
10698
# Let's download some system packages!
10799
# Note that the precise list of packages we need is intertwined not just
@@ -232,7 +224,7 @@ jobs:
232224
cp dist/*.whl /wheels/
233225
chmod a+rwx /wheels/*.whl
234226
235-
- uses: actions/upload-artifact@v3
227+
- uses: actions/upload-artifact@v4
236228
with:
237229
name: wheels
238230
path: ./wheels/*
@@ -243,7 +235,7 @@ jobs:
243235
with:
244236
arch: none
245237
distro: none
246-
base_image: ${{ matrix.image }}
238+
base_image: ${{ matrix.config.image }}
247239

248240
setup: |
249241
mkdir -p "${PWD}/wheels"
@@ -254,7 +246,7 @@ jobs:
254246
shell: /bin/sh
255247

256248
install: |
257-
case "${{ matrix.image }}" in
249+
case "${{ matrix.config.image }}" in
258250
*debian*)
259251
PACKAGES=""
260252
PACKAGES="${PACKAGES} python3"
@@ -280,7 +272,7 @@ jobs:
280272
281273
python3 -m venv /venv
282274
. /venv/bin/activate
283-
case "${{ matrix.image }}" in
275+
case "${{ matrix.config.image }}" in
284276
*debian*)
285277
python3 -m pip install --upgrade hatch hatch-fancy-pypi-readme hatch-mkdocs
286278
hatch run testinstalled:install /wheels/*.whl
@@ -307,7 +299,7 @@ jobs:
307299
# Note that to maximize compatibility of generated wheels, we build on the
308300
# *oldest* supported GitHub-hosted runners, per
309301
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
310-
- os: windows-2019 # x86_64
302+
- os: windows-latest # x86_64
311303
- os: macos-11 # this is the earliest x86_64 runner
312304
- os: macos-14 # this is the earliest arm64 runner
313305

@@ -336,7 +328,7 @@ jobs:
336328
python3 -m pip install --upgrade build
337329
python3 -m build --wheel
338330
339-
- uses: actions/upload-artifact@v3
331+
- uses: actions/upload-artifact@v4
340332
with:
341333
name: wheels
342334
path: dist/*
@@ -359,7 +351,7 @@ jobs:
359351
runs-on: ubuntu-latest
360352

361353
steps:
362-
- uses: actions/download-artifact@v3
354+
- uses: actions/download-artifact@v4
363355

364356
- name: Compute release version
365357
run: |
@@ -386,7 +378,7 @@ jobs:
386378
permissions:
387379
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
388380
steps:
389-
- uses: actions/download-artifact@v3
381+
- uses: actions/download-artifact@v4
390382

391383
- name: Make dist directory
392384
run: mkdir dist && cp wheels/* sdist/* dist/

ARCHITECTURE.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ PyMiniRacer!) which wants to integrate V8 must first build it.
154154
### Build PyPI wheels
155155

156156
Because V8 takes so long to build (about 2-3 hours at present on the free GitHub Actions
157-
runners, and >12 hours when emulating `aarch64` on them), we want to build wheels for
158-
PyPI. We don't want folks to have to build V8 when they `pip install mini-racer`!
157+
runners), we want to build wheels for PyPI. We don't want folks to have to build V8 when
158+
they `pip install mini-racer`!
159159

160160
We build wheels for many operating systems and architectures based on popular demand via
161161
GitHib issues. Currently the list is
@@ -238,6 +238,11 @@ wouldn't simplify the overall workflow management.
238238

239239
### Use `sccache` to patch around build timeouts
240240

241+
**Update: We still use `sscache` but with
242+
[the new Github-hosted `aarch64` runners](https://github.com/actions/runner-images/issues/10820),
243+
this should no longer be strictly required. We no longer run builds on emulation as
244+
discussed below.**
245+
241246
As of this writing, the Linux `aarch64` builds run on emulation becaues GitHub Actions
242247
has no free hosted `aarch64` runners for Linux. This makes them so slow, they struggle
243248
to complete at all. They take about 24 hours to run. The GitHub Actions

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ If you are proposing a feature:
5050
Ready to contribute? Here's how to set up `PyMiniRacer` for local development.
5151

5252
!!! warning
53+
5354
Building this package from source takes several GB of disk space and takes 1-2 hours.
5455

5556
1. Do a quick scan through [the architecture guide](ARCHITECTURE.md) before diving in.
@@ -220,6 +221,7 @@ To make an ordinary release from `main`:
220221
wheels to PyPI automatically.
221222
222223
!!! warning
224+
223225
As of this writing, the `aarch64` Linux builds are slow because they're running on
224226
emulation. They time out on the first try (and second and third and...) after 6
225227
hours. If you "restart failed jobs", they will quickly catch up to where where they

HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234

235235
## 0.1.9 (2017-03-24)
236236

237-
- Fix the compilation for Ubuntu 12.04 and glibc \< 2.17.
237+
- Fix the compilation for Ubuntu 12.04 and glibc < 2.17.
238238

239239
## 0.1.8 (2017-03-02)
240240

helpers/v8_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
LOGGER = getLogger(__name__)
1919
LOGGER.setLevel(DEBUG)
2020
ROOT_DIR = dirname(abspath(__file__))
21-
V8_VERSION = "branch-heads/12.6"
21+
V8_VERSION = "branch-heads/13.2"
2222

2323

2424
def local_path(path="."):

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ dependencies = [
104104
]
105105

106106
[[tool.hatch.envs.test.matrix]]
107-
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
107+
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
108108

109109
# An environment to test installed wheels
110110
[tool.hatch.envs.testinstalled]
@@ -120,7 +120,7 @@ dependencies = [
120120
]
121121

122122
[[tool.hatch.envs.testinstalled.matrix]]
123-
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
123+
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
124124

125125
[tool.hatch.envs.testinstalled.scripts]
126126
# A weird trick to smuggle the just-built wheel into the env, for matrix testing:

src/py_mini_racer/_value_handle.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from datetime import datetime, timezone
55
from typing import (
66
TYPE_CHECKING,
7+
Any,
78
ClassVar,
89
)
910

@@ -23,9 +24,12 @@
2324
PythonJSConvertedTypes,
2425
)
2526

27+
if TYPE_CHECKING:
28+
from collections.abc import Sequence
29+
2630

2731
class _RawValueUnion(ctypes.Union):
28-
_fields_: ClassVar[list[tuple[str, object]]] = [
32+
_fields_: ClassVar[Sequence[tuple[str, Any]]] = [
2933
("value_ptr", ctypes.c_void_p),
3034
("bytes_val", ctypes.POINTER(ctypes.c_char)),
3135
("char_p_val", ctypes.c_char_p),
@@ -35,7 +39,7 @@ class _RawValueUnion(ctypes.Union):
3539

3640

3741
class _RawValue(ctypes.Structure):
38-
_fields_: ClassVar[list[tuple[str, object]]] = [
42+
_fields_: ClassVar[Sequence[tuple[str, Any]]] = [
3943
("value", _RawValueUnion),
4044
("len", ctypes.c_size_t),
4145
("type", ctypes.c_uint8),
@@ -52,7 +56,7 @@ class _RawValue(ctypes.Structure):
5256
class _ArrayBufferByte(ctypes.Structure):
5357
# Cannot use c_ubyte directly because it uses <B
5458
# as an internal type but we need B for memoryview.
55-
_fields_: ClassVar[list[tuple[str, object]]] = [
59+
_fields_: ClassVar[list[tuple[str, Any]]] = [
5660
("b", ctypes.c_ubyte),
5761
]
5862
_pack_ = 1

0 commit comments

Comments
 (0)