Skip to content

Commit

Permalink
Python 3.13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
buffer committed Oct 16, 2024
1 parent e660f5f commit 5d8d3c7
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 129 deletions.
33 changes: 8 additions & 25 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
name: Linux build/release workflow

on:
push:
pull_request:
release:
types: [published]
branches:
- master

branches: [master]
jobs:
build-v8:
# If Google V8 is in the workflow cache, don't build it.
Expand All @@ -20,14 +18,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Clone Google V8
run: |
python -m pip install wheel
echo "::group::Clone Google V8"
python setup.py checkout_v8
echo "::endgroup::"
- name: Restore Google V8 from cache
id: restore-v8
uses: actions/cache/restore@main
Expand All @@ -37,7 +33,6 @@ jobs:
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: linux-build-v8-${{ hashFiles('v8/src/**') }}

- name: Build Google V8
id: build-v8
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
Expand All @@ -48,7 +43,6 @@ jobs:
echo "::group::v8"
python setup.py v8
echo "::endgroup::"
- name: Save Google V8 to cache
uses: actions/cache/save@main
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
Expand All @@ -60,7 +54,6 @@ jobs:
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: linux-build-v8-${{ hashFiles('v8/src/**') }}

build:
name: Build Linux wheel (Python ${{ matrix.python-version }})
needs: build-v8
Expand All @@ -71,32 +64,29 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.9', '3.10', '3.11', '3.12']
boost-version: ['1.84.0']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
boost-version: [1.84.0]
boost-version-snake: ['1_84_0']
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Download Boost
id: download-boost
uses: suisei-cn/[email protected]
with:
url: https://boostorg.jfrog.io/artifactory/main/release/${{ matrix.boost-version }}/source/boost_${{ matrix.boost-version-snake }}.zip

url: https://boostorg.jfrog.io/artifactory/main/release/${{ matrix.boost-version }}/source/boost_${{
matrix.boost-version-snake }}.zip
- name: Install Boost
id: install-boost
run: |
unzip -q ${{ steps.download-boost.outputs.filename }}
cd boost_${{ matrix.boost-version-snake }}
./bootstrap.sh
sudo ./b2 install -j 8 --with-system --with-python --with-filesystem --with-iostreams --with-date_time --with-thread
- name: Restore Google V8 from cache
id: restore-v8
uses: actions/cache/restore@main
Expand All @@ -106,44 +96,37 @@ jobs:
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: linux-build-v8-${{ needs.build-v8.outputs.v8-hash }}

- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel auditwheel patchelf pytest pytest-order
- name: Build wheel
run: |
python setup.py sdist bdist_wheel --skip-build-v8 -d stpyv8-linux-wheelhouse-${{ matrix.python-version }}
env:
INCLUDE: ${{ env.INCLUDE }};${{ steps.install-python.outputs.python-path }}include
INCLUDE: ${{ env.INCLUDE }};${{ steps.install-python.outputs.python-path
}}include
V8_DEPS_LINUX: 0
LDFLAGS: -L/usr/lib -L/usr/lib/x86_64-linux-gnu

- name: Repair wheel
run: |
auditwheel repair --plat manylinux_2_31_x86_64 -w stpyv8-linux-${{ matrix.python-version }} stpyv8-linux-wheelhouse-${{ matrix.python-version }}/*.whl
- name: Install wheel
run: |
python -m pip install stpyv8-linux-${{ matrix.python-version }}/*.whl
- name: Test wheel
run: |
pytest -v
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: stpyv8-linux-python${{ matrix.python-version }}
path: stpyv8-linux-${{ matrix.python-version }}/*.whl

- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' }}
with:
files: stpyv8-linux-${{ matrix.python-version }}/*.whl
token: ${{ secrets.GITHUB_TOKEN }}

pypi-publish:
name: Upload release to PyPI
if: ${{ github.event_name == 'release' }}
Expand Down
42 changes: 12 additions & 30 deletions .github/workflows/osx-arm64.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
---
name: MacOSX ARM64 build/release workflow

on:
push:
pull_request:
release:
types: [published]
branches:
- master

branches: [master]
jobs:
build-v8:
# If Google V8 is in the workflow cache, don't build it.
# Cloning the repository is still necessary in any case
# to calculate the hash for the cache key
name: Build Google V8
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]
Expand All @@ -23,14 +21,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Clone Google V8
run: |
python3 -m pip install --break-system-packages wheel setuptools
echo "::group::Clone Google V8"
python3 setup.py checkout_v8
echo "::endgroup::"
- name: Restore Google V8 from cache
id: restore-v8
uses: actions/cache/restore@main
Expand All @@ -40,7 +36,6 @@ jobs:
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: ${{ matrix.os }}-arm64-build-v8-${{ hashFiles('v8/src/**') }}

- name: Build Google V8
id: build-v8
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
Expand All @@ -51,7 +46,6 @@ jobs:
echo "::group::v8"
python3 setup.py v8
echo "::endgroup::"
- name: Save Google V8 to cache
uses: actions/cache/save@main
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
Expand All @@ -63,43 +57,38 @@ jobs:
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: ${{ matrix.os }}-arm64-build-v8-${{ hashFiles('v8/src/**') }}

build:
name: Build OSX ARM64 wheel (Python ${{ matrix.python-version }})
needs: build-v8
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]
python-version: ['3.10', '3.11', '3.12']
boost-version: ['1.84.0']
python-version: ['3.10', '3.11', '3.12', '3.13']
boost-version: [1.84.0]
boost-version-snake: ['1_84_0']
env:
ARCH: arm64

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Download Boost
id: download-boost
uses: suisei-cn/[email protected]
with:
url: https://boostorg.jfrog.io/artifactory/main/release/${{ matrix.boost-version }}/source/boost_${{ matrix.boost-version-snake }}.zip

url: https://boostorg.jfrog.io/artifactory/main/release/${{ matrix.boost-version }}/source/boost_${{
matrix.boost-version-snake }}.zip
- name: Install Boost
id: install-boost
run: |
unzip -q ${{ steps.download-boost.outputs.filename }}
cd boost_${{ matrix.boost-version-snake }}
./bootstrap.sh
sudo ./b2 install -j 8 --with-system --with-python --with-filesystem --with-iostreams --with-date_time --with-thread
- name: Restore Google V8 from cache
id: restore-v8
uses: actions/cache/restore@main
Expand All @@ -108,45 +97,38 @@ jobs:
v8/out.gn/x64.release.sample/obj/libv8_monolith.a
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: ${{ matrix.os }}-arm64-build-v8-${{ needs.build-v8.outputs.v8-hash }}

key: ${{ matrix.os }}-arm64-build-v8-${{ needs.build-v8.outputs.v8-hash
}}
- name: Install dependencies
run: |
pip install --upgrade --break-system-packages pip setuptools delocate wheel pytest pytest-order
- name: Build wheel
run: |
python3 setup.py sdist bdist_wheel --skip-build-v8 -d stpyv8-${{ matrix.os }}-${{ matrix.python-version }}
python3 setup.py sdist bdist_wheel --skip-build-v8 -d stpyv8-${{ matrix.os }}-${{ matrix.python-version }}
env:
ARCHFLAGS: '-arch arm64'
_PYTHON_HOST_PLATFORM: 'macosx-11.0-arm64'

ARCHFLAGS: -arch arm64
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
- name: Repair wheel
run: |
delocate-listdeps stpyv8-${{ matrix.os }}-${{ matrix.python-version }}/stpyv8*.whl
delocate-wheel --require-archs arm64 stpyv8-${{ matrix.os }}-${{ matrix.python-version }}/stpyv8*.whl
- name: Install wheel
run: |
python3 -m pip install --break-system-packages stpyv8-${{ matrix.os }}-${{ matrix.python-version }}/*.whl
- name: Test wheel
run: |
pytest -v
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: stpyv8-${{ matrix.os }}-python${{ matrix.python-version }}
path: stpyv8-${{ matrix.os }}-${{ matrix.python-version }}/*.whl

- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' }}
with:
files: stpyv8-${{ matrix.os }}-${{ matrix.python-version }}/*.whl
token: ${{ secrets.GITHUB_TOKEN }}

pypi-publish:
name: Upload release to PyPI
if: ${{ github.event_name == 'release' }}
Expand Down
Loading

0 comments on commit 5d8d3c7

Please sign in to comment.