Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add m1 runner #120

Closed
wants to merge 15 commits into from
133 changes: 87 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,44 +44,41 @@ jobs:
fail-fast: false
matrix:
info:
- { machine: 'ubuntu-20.04', python: '3.6', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'ubuntu-20.04', python: '3.7', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'ubuntu-20.04', python: '3.8', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'ubuntu-20.04', python: '3.9', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'ubuntu-20.04', python: '3.10', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'ubuntu-20.04', python: '3.11', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'ubuntu-20.04', python: '3.12', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
- { machine: 'windows-2022', python: '3.6', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'windows-2022', python: '3.7', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'windows-2022', python: '3.8', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'windows-2022', python: '3.9', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'windows-2022', python: '3.10', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'windows-2022', python: '3.11', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'windows-2022', python: '3.12', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'macos-11', python: '3.6', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-11', python: '3.7', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-11', python: '3.8', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-11', python: '3.9', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-11', python: '3.10', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-11', python: '3.11', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-11', python: '3.12', pythonArchitecture: 'x64', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
# Add M1 powered runners when available
# https://github.com/jpy-consortium/jpy/issues/110
# - { machine: 'ubuntu-20.04', python: '3.6', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'ubuntu-20.04', python: '3.7', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'ubuntu-20.04', python: '3.8', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'ubuntu-20.04', python: '3.9', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'ubuntu-20.04', python: '3.10', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'ubuntu-20.04', python: '3.11', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'ubuntu-20.04', python: '3.12', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
# - { machine: 'windows-2022', python: '3.6', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
# - { machine: 'windows-2022', python: '3.7', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
# - { machine: 'windows-2022', python: '3.8', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
# - { machine: 'windows-2022', python: '3.9', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
# - { machine: 'windows-2022', python: '3.10', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
# - { machine: 'windows-2022', python: '3.11', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
# - { machine: 'windows-2022', python: '3.12', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
- { machine: 'macos-12', python: '3.6', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-12', python: '3.7', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-12', python: '3.11', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-12', python: '3.12', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }


steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.info.python }}
architecture: ${{ matrix.info.pythonArchitecture }}

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
id: setup-java
with:
distribution: 'temurin'
distribution: 'zulu'
java-version: '8'

- run: pip install --upgrade pip
- run: pip install --upgrade setuptools
- run: ${{ matrix.info.cmd }}

- uses: actions/upload-artifact@v3
Expand All @@ -90,35 +87,79 @@ jobs:
path: dist/*.whl
retention-days: 1

bdist-wheels-linux-arm64:
runs-on: 'ubuntu-22.04'
steps:
- uses: actions/checkout@v3
# https://github.com/actions/setup-python/issues/547
# https://github.com/actions/python-versions/pull/114
# https://github.com/actions/python-versions/pull/175
# https://github.com/pypa/cibuildwheel/blob/v2.16.2/cibuildwheel/macos.py#L247-L260
# Python 3.11+ has universal2 support
# https://github.com/actions/runner-images/issues/4133
bdist-wheel-universal2-hack:
runs-on: ${{ matrix.info.machine }}
env:
_PYTHON_HOST_PLATFORM: macosx-11.0-universal2
ARCHFLAGS: -arch arm64 -arch x86_64
strategy:
fail-fast: false
matrix:
info:
- { machine: 'macos-12', python: '3.8', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-12', python: '3.9', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
- { machine: 'macos-12', python: '3.10', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.info.python }}

- name: Bake
uses: docker/[email protected]
- uses: actions/setup-java@v4
id: setup-java
with:
files: .github/docker/docker-bake.hcl
pull: true
set: |
*.platform=linux/arm64/v8
*.output=type=local,dest=/tmp/dist
distribution: 'zulu'
java-version: '8'

- run: pip install --upgrade pip
- run: pip install --upgrade setuptools
- run: ${{ matrix.info.cmd }}

- uses: actions/upload-artifact@v3
with:
name: bdist-wheels-linux-arm64
path: /tmp/dist/*.whl
name: build-${{ matrix.info.python }}-${{ matrix.info.machine }}-${{ matrix.info.arch }}
path: dist/*.whl
retention-days: 1


# bdist-wheels-linux-arm64:
# runs-on: 'ubuntu-22.04'
# steps:
# - 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: Bake
# uses: docker/[email protected]
# with:
# files: .github/docker/docker-bake.hcl
# pull: true
# set: |
# *.platform=linux/arm64/v8
# *.output=type=local,dest=/tmp/dist
#
# - uses: actions/upload-artifact@v3
# with:
# name: bdist-wheels-linux-arm64
# path: /tmp/dist/*.whl
# retention-days: 1

collect-artifacts:
runs-on: ubuntu-22.04
needs: ['sdist', 'bdist-wheel', 'bdist-wheels-linux-arm64']
# needs: ['sdist', 'bdist-wheel', 'bdist-wheels-linux-arm64']
needs: [ 'sdist', 'bdist-wheel', 'bdist-wheel-universal2-hack' ]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
Expand Down Expand Up @@ -165,4 +206,4 @@ jobs:
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Loading