chore: prepare for 0.4.0 release #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Wheels | |
on: | |
push: | |
branches: ["master"] | |
paths: [".github/workflows/build_wheel.yml", "dither_go/**", "!dither_go/bindings/**"] | |
pull_request: | |
paths: [".github/workflows/build_wheel.yml", "dither_go/**", "!dither_go/bindings/**"] | |
release: | |
types: [published] | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
build_sdist: | |
name: Source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: source | |
path: dist/*.tar.gz | |
build_macos: | |
#if: false | |
name: MacOS ${{ matrix.arch_cibw_go[0] }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch_cibw_go: | |
- [ "x86_64", "amd64" ] | |
- [ "arm64", "arm64" ] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.x" | |
- name: Install gopy | |
run: go install github.com/go-python/gopy@v0.4.7 | |
- name: Install goimports | |
run: go install golang.org/x/tools/cmd/goimports@latest | |
- name: Build wheels | |
run: ./tools/macos_build_wheels.sh | |
env: | |
CIBW_ARCHS: ${{ matrix.arch_cibw_go[0] }} | |
CIBW_BUILD_FRONTEND: "build" | |
PYTHON_BINARY_PATH: /usr/local/bin/python_for_build | |
CIBW_ENVIRONMENT: > | |
PATH=$PATH:/usr/local/go/bin | |
GOARCH=${{ matrix.arch_cibw_go[1] }} | |
CGO_ENABLED=1 | |
MACOSX_DEPLOYMENT_TARGET=10.15 | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_linux_x86_64: | |
#if: false | |
name: Linux x86_64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.15.0 | |
with: | |
package-dir: . | |
env: | |
CIBW_BUILD: "cp3*_x86_64" | |
CIBW_BUILD_FRONTEND: "build" | |
CIBW_SKIP: "cp36-* cp37-* *-musllinux_x86_64" | |
CIBW_ARCHS: "native" | |
CIBW_ENVIRONMENT: > | |
PATH=$PATH:/usr/local/go/bin | |
CGO_ENABLED=1 | |
CIBW_BEFORE_ALL_LINUX: | | |
curl -o go.tar.gz https://dl.google.com/go/go1.20.7.linux-amd64.tar.gz | |
tar -C /usr/local -xzf go.tar.gz | |
go install github.com/go-python/gopy@v0.4.7 | |
go install golang.org/x/tools/cmd/goimports@latest | |
./tools/linux_compile_libwebp.sh | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_linux_arm64: | |
#if: false | |
name: Linux arm64 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python3_version: [ 8, 9, 10, 11 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Build 3.${{ matrix.python3_version }} wheels | |
uses: pypa/cibuildwheel@v2.15.0 | |
with: | |
package-dir: . | |
env: | |
CIBW_BUILD: "cp3${{ matrix.python3_version }}*_aarch64" | |
CIBW_BUILD_FRONTEND: "build" | |
CIBW_SKIP: "cp36-* cp37-* *-musllinux_aarch64" | |
CIBW_ARCHS: "aarch64" | |
CIBW_ENVIRONMENT: > | |
PATH=$PATH:/usr/local/go/bin | |
CGO_ENABLED=1 | |
CIBW_BEFORE_ALL_LINUX: | | |
curl -o go.tar.gz https://dl.google.com/go/go1.20.7.linux-arm64.tar.gz | |
tar -C /usr/local -xzf go.tar.gz | |
go install github.com/go-python/gopy@v0.4.7 | |
go install golang.org/x/tools/cmd/goimports@latest | |
./tools/linux_compile_libwebp.sh | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_linux_armv7l: | |
if: false # Disable for now; It can't find source files for some reason | |
name: Linux armv7l | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python3_version: [ 8, 9, 10, 11 ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build 3.${{ matrix.python3_version }} wheels via Docker | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./tools/Dockerfile.armv7l | |
build-args: | | |
PYTHON3_VERSION=${{ matrix.python3_version }} | |
push: false | |
platforms: linux/armhf | |
tags: armv7l:latest | |
load: true | |
- name: Extract output | |
run: | | |
docker run -v /tmp/output:/host armv7l:latest bash -c "cp /export/* /host/" | |
tar -zcvf /tmp/output.tar.gz /tmp/output | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: /tmp/output/*.whl | |
build_windows: | |
if: false # TODO: Modify to use MinGW instead | |
name: Windows x86_64 | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.x" | |
# TODO: Make a fork of this fork to update to 0.4.7 | |
- name: Install gopy | |
run: | | |
cd $env:TEMP | |
git clone https://github.com/bjia56/gopy | |
cd gopy | |
git checkout v0.4.5+bjia56.v1 | |
go install -v | |
gopy | |
- name: Install goimports | |
run: go install golang.org/x/tools/cmd/goimports@latest | |
- name: Compile Libwebp | |
run: | | |
curl -o libwebp.tar.gz https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.1.tar.gz | |
tar -xzf libwebp.tar.gz | |
cd libwebp-1.3.1 | |
nmake /f Makefile.vc CFG=release-dynamic RTLIBCFG=dynamic OBJDIR=output | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.15.0 | |
with: | |
package-dir: . | |
env: | |
CIBW_BUILD: "cp3*" | |
CIBW_BUILD_FRONTEND: "build" | |
CIBW_SKIP: "cp36-* cp37-*" | |
CIBW_ARCHS: "native" | |
CIBW_ENVIRONMENT: > | |
GOARCH=amd64 | |
CGO_ENABLED=1 | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
upload_to_pypi: | |
name: Upload to PyPI | |
needs: | |
- build_sdist | |
- build_macos | |
- build_linux_x86_64 | |
- build_linux_arm64 | |
#- build_linux_armv7l | |
#- build_windows | |
runs-on: ubuntu-latest | |
environment: pypi-upload | |
permissions: | |
id-token: write | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Get source distribution | |
uses: actions/download-artifact@v3 | |
with: | |
name: source | |
path: dist | |
- name: Get all built distributions | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
all_builds_passed: | |
needs: | |
- build_sdist | |
- build_macos | |
- build_linux_x86_64 | |
- build_linux_arm64 | |
#- build_linux_armv7l | |
#- build_windows | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "All builds passed!" |