fix: nodejs bindings build #54
Workflow file for this run
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: Python | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- go_target: amd64 | |
cibw_target: x86_64 | |
#- go_target:'386 | |
# cibw_target: i686 | |
- go_target: arm64 | |
cibw_target: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: matrix.go_target == 'arm64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: bindings/py | |
env: | |
CIBW_ARCHS: ${{ matrix.cibw_target }} | |
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux_2_28_i686 | |
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 | |
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64 | |
CIBW_BEFORE_ALL: .ci/ensure-go.sh; cd bindings/py; go mod init github.com/tdewolff/minify/bindings/py; go mod tidy; go build -buildmode=c-shared -o src/minify/minify.so | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.go_target }} | |
path: ./wheelhouse/*.whl | |
windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
include: | |
- go_target: amd64 | |
cibw_target: AMD64 | |
#- go_target: 386 | |
# cibw_target: x86 | |
#- go_target: arm64 | |
# cibw_target: ARM64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.17' | |
- name: Build Windows extension | |
run: | | |
cd bindings/py | |
set GOOS=windows | |
set GOARCH=${{ matrix.go_target }} | |
set CGO_ENABLED=1 | |
#go get github.com/tdewolff/minify/v2@${{ github.ref_name }} | |
go mod init github.com/tdewolff/minify/bindings/js | |
go mod tidy | |
go build -buildmode=c-shared -o src/minify/minify.so | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: bindings/py | |
env: | |
CIBW_ARCHS: ${{ matrix.cibw_target }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-windows-${{ matrix.go_target }} | |
path: ./wheelhouse/*.whl | |
macos: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
include: | |
- go_target: amd64 | |
cibw_target: x86_64 | |
#- go_target: arm64 | |
# cibw_target: arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.17' | |
- name: Build MacOS extension | |
run: | | |
cd bindings/py | |
export GOOS=darwin | |
export GOARCH=${{ matrix.go_target }} | |
export CGO_ENABLED=1 | |
export MACOSX_DEPLOYMENT_TARGET=10.9 | |
#go get github.com/tdewolff/minify/v2@${{ github.ref_name }} | |
go mod init github.com/tdewolff/minify/bindings/js | |
go mod tidy | |
go build -buildmode=c-shared -o src/minify/minify.so | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: bindings/py | |
env: | |
CIBW_ARCHS: ${{ matrix.cibw_target }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.go_target }} | |
path: ./wheelhouse/*.whl | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.17' | |
- name: Update version in go.mod | |
run: | | |
cd bindings/py | |
#go get github.com/tdewolff/minify/v2@${{ github.ref_name }} | |
go mod init github.com/tdewolff/minify/bindings/js | |
go mod tidy | |
- name: Install dependencies | |
run: pip install build | |
- name: Build package | |
run: | | |
cd bindings/py | |
python -m build --sdist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: bindings/py/dist/* | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [linux, windows, macos, sdist] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: bindings/py/artifacts | |
- name: Bundle release artifacts | |
run: | | |
cd bindings/py/ | |
#rm -r artifacts/*.so | |
mkdir dist | |
mv artifacts/*/* dist/ | |
- name: Upload to GitHub Release | |
uses: softprops/[email protected] | |
with: | |
files: bindings/py/dist/* | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages-dir: bindings/py/dist/ |