Build Wheels #29
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 (Testing) | |
on: | |
push: | |
branches: ["fix-workflow"] | |
paths: ["dither_go/**", ".github/workflows/build_wheel.yml"] | |
pull_request: | |
paths: ["dither_go/**", ".github/workflows/build_wheel.yml"] | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
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] }} | |
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_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 | |
curl -o libwebp.tar.gz https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.1-linux-x86-64.tar.gz | |
tar -xzf libwebp.tar.gz | |
cp -r libwebp-1.3.1-linux-x86-64/include libwebp-1.3.1-linux-x86-64/lib /usr/local | |
- 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_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 | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_linux_armv7l: | |
#if: false | |
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 # Disable for now | |
name: Windows x86_64 | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: Build wheels | |
uses: pypa/cibuildwheel@v2.15.0 | |
with: | |
package-dir: . | |
env: | |
CIBW_BUILD: "cp3*" | |
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 | |
all_builds_passed: | |
needs: | |
- build_macos | |
- build_linux_x86_64 | |
- build_linux_arm64 | |
- build_linux_armv7l | |
#- build_windows | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "All builds passed!" |