Skip to content

[Github Actions] macOS debug build workflow improvements #29

[Github Actions] macOS debug build workflow improvements

[Github Actions] macOS debug build workflow improvements #29

Workflow file for this run

name: MacOSX build workflow (debug)
on: [push, pull_request]
env:
BOOST_ROOT: boost
BOOST_VERSION: 1.83.0
STPYV8_DEBUG: 1
jobs:
build:
name: Build STPyV8
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, macos-13]
python-version: ['3.11']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Don't build Google V8 if it is already in the workflow cache
# Cloning is necessary in any case to calculate a hash for the
# cache key
- 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
with:
path: |
v8/out.gn/x64.release.sample/obj/libv8_libbase.a
v8/out.gn/x64.release.sample/obj/libv8_libplatform.a
v8/out.gn/x64.release.sample/obj/libv8_monolith.lib
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: ${{ matrix.os }}-build-v8-${{ hashFiles('v8/src/**') }}
- name: Build Google V8
id: build-v8
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
continue-on-error: false
run: |
echo "v8-hash=${{ hashFiles('v8/src/**') }}" >> "$GITHUB_OUTPUT"
python -m pip install wheel
echo "::group::v8"
python setup.py v8
ls v8/out.gn/x64.release.sample/obj/
echo "::endgroup::"
- name: Save Google V8 to cache
uses: actions/cache/save@main
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
with:
# Save compiled binary and header files
# This will save an additional clone of v8 for the linker
path: |
v8/out.gn/x64.release.sample/obj/libv8_libbase.a
v8/out.gn/x64.release.sample/obj/libv8_libplatform.a
v8/out.gn/x64.release.sample/obj/libv8_monolith.a
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: ${{ matrix.os }}-build-v8-${{ steps.build.outputs.v8-hash }}
- name: Platform configuration for macos-11
if: ${{ matrix.os == 'macos-11' }}
run:
echo "PLATFORM_VERSION=11" >> $GITHUB_ENV
- name: Platform configuration for macos-12
if: ${{ matrix.os == 'macos-12' }}
run:
echo "PLATFORM_VERSION=12" >> $GITHUB_ENV
- name: Platform configuration for macos-13
if: ${{ matrix.os == 'macos-13' }}
run:
echo "PLATFORM_VERSION=13" >> $GITHUB_ENV
- name: Install Boost
uses: MarkusJx/install-boost@main
id: install-boost
with:
link: static
boost_version: ${{ env.BOOST_VERSION }}
platform_version: ${{ env.PLATFORM_VERSION }}
- name: Restore Google V8 from cache
if: ${{ steps.restore-v8.outputs.cache-hit != 'true' }}
id: restore-cached-v8
uses: actions/cache/restore@main
with:
path: |
v8/out.gn/x64.release.sample/obj/libv8_libbase.a
v8/out.gn/x64.release.sample/obj/libv8_libplatform.a
v8/out.gn/x64.release.sample/obj/libv8_monolith.lib
v8/out.gn/x64.release.sample/icudtl.dat
v8/include
key: ${{ matrix.os }}-build-v8-${{ steps.build.outputs.v8-hash }}
- name: Build wheel
env:
INCLUDE: ${{steps.install-boost.outputs.BOOST_ROOT}}/include
run: |
python -m pip install wheel pytest
# Google V8 build should be already be supplied from the cache so no need to rebuild
python setup.py sdist bdist_wheel --skip-build-v8 -d stpyv8-${{ matrix.os }}-${{ matrix.python-version }}-debug/
if (-not $?) {
echo "::error::Wheel build failed"
exit 1
}
python setup.py install
if (-not $?) {
echo "::error::Wheel installation failed"
exit 1
}
ls v8/out.gn/x64.release.sample/
cp v8/out.gn/x64.release.sample/icudtl.dat stpyv8-${{ matrix.os }}-${{ matrix.python-version }}-debug/
- name: Test wheel
run: |
pytest -v
- name: Create wheel zip
uses: vimtor/action-zip@v1.1
with:
files: stpyv8-${{ matrix.os }}-${{ matrix.python-version }}-debug/
recursive: false
dest: stpyv8-${{ matrix.os }}-python-${{ matrix.python-version }}-debug.zip
- name: Upload wheel zip
uses: actions/upload-artifact@v3
with:
name: wheels
path: stpyv8-${{ matrix.os }}-python-${{ matrix.python-version }}-debug.zip