Skip to content

Commit

Permalink
build single wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Aug 29, 2024
1 parent 74f150b commit ae50016
Showing 1 changed file with 8 additions and 155 deletions.
163 changes: 8 additions & 155 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,127 +2,28 @@ name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
branches: [format_code]

jobs:
prebuild_linux_aarch64_3rd_party:
name: Build skia bundled 3rd-party on linux/aarch64
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/cache@v4
id: cache-skia
with:
path: |
gn
skia
key: linux-aarch64-skia-${{ github.sha }}-3rd-party
- name: Pre-fetch skia deps
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m128-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m128-minimize-download.patch
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build skia 3rd-Party
# Taken from https://github.com/pypa/cibuildwheel/blob/v2.19.2/cibuildwheel/resources/pinned_docker_images.cfg
uses: docker://quay.io/pypa/manylinux2014_aarch64:2024.07.02-0
if: ${{ steps.cache-skia.outputs.cache-hit != 'true' }}
with:
args: bash -c "git config --global --add safe.directory '*' &&
bash scripts/build_Linux.sh &&
chmod a+rwx -R skia"

prebuild_linux_aarch64:
name: Build skia on linux/aarch64
needs: prebuild_linux_aarch64_3rd_party
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/cache@v4
id: cache-skia
with:
path: |
gn
skia
key: linux-aarch64-skia-${{ github.sha }}
- uses: actions/cache/restore@v4
with:
path: |
gn
skia
key: linux-aarch64-skia-${{ github.sha }}-3rd-party
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Skia Proper
uses: docker://quay.io/pypa/manylinux2014_aarch64:2024.07.02-0
with:
args: bash -c "git config --global --add safe.directory '*' &&
bash scripts/build_Linux.sh

build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}) for ${{ matrix.cp }}
needs: prebuild_linux_aarch64
runs-on: ${{ matrix.os }}
name: Build wheels on ubuntu-22.04 (auto64) for cp310
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]
arch: [auto64]
cp: ["cp3{8,9,10,11,12}"]
include:
- os: macos-12
arch: arm64
cp: "cp3{8,9,10,11,12}"
# aarch64 is emulated and takes longer, build one wheel per job
- os: ubuntu-22.04
arch: aarch64
cp: cp38
- os: ubuntu-22.04
arch: aarch64
cp: cp39
- os: ubuntu-22.04
arch: aarch64
cp: cp310
- os: ubuntu-22.04
arch: aarch64
cp: cp311
- os: ubuntu-22.04
arch: aarch64
cp: cp312

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/cache/restore@v4
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
with:
path: |
gn
skia
key: linux-aarch64-skia-${{ github.sha }}

- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.arch }}

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "${{ matrix.cp }}-*"
CIBW_BUILD: "cp310-*"
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh
CIBW_ARCHS: auto64
CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=auto64 MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_BEFORE_ALL: bash scripts/build_Linux.sh
CIBW_BEFORE_BUILD: pip install pybind11 numpy
CIBW_TEST_REQUIRES: pytest pillow glfw
CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl
Expand All @@ -133,53 +34,5 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.cp }}
name: wheel-ubuntu-22.04-auto64-cp310
path: ./wheelhouse/*.whl

build_docs:
name: Build docs
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'

- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist

- name: Build docs
run: |
python -m pip install --pre -f dist skia-python
python -m pip install sphinx==6.2.1 sphinx-rtd-theme
python setup.py build_sphinx
- name: Deploy docs
if: github.event_name == 'release' && github.event.action == 'published'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html

publish:
name: Upload packages to PyPI
needs: [build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/skia-python/
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit ae50016

Please sign in to comment.