Skip to content

Commit

Permalink
Merge pull request #167 from QuTech-Delft/update-master-to-release-0.7.2
Browse files Browse the repository at this point in the history
Update  `master` to release 0.7.2
  • Loading branch information
rturrado authored Nov 22, 2024
2 parents 5196c8e + 21c2f93 commit ca10380
Show file tree
Hide file tree
Showing 51 changed files with 1,939 additions and 1,383 deletions.
291 changes: 42 additions & 249 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,283 +9,76 @@ on:
- "release**"

jobs:
macos-x64:
name: PyPI wheels for macOS/x64
runs-on: macos-13 # x64
cibw-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
# macos-13 is an x64 runner, macos-14 is an arm64 runner
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip conan setuptools wheel
brew install swig
- name: Build wheel
env:
QX_CPU_COMPATIBILITY_MODE: "True"
NPROCS: 10
run: python setup.py bdist_wheel
- name: Wheel path
id: wheel
working-directory: pybuild/dist/
run: |
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_OUTPUT
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_ENV
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: pypi-macos-x64-py${{ matrix.python }}
path: pybuild/dist/${{ env.WHEEL_NAME }}
- uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: pybuild/dist/${{ env.WHEEL_NAME }}
asset_name: ${{ env.WHEEL_NAME }}
asset_content_type: application/zip
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

macos-arm64:
name: PyPI wheels for macOS/arm64
runs-on: macos-14 # arm64
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
cibw-wheels-linux-arm64:
name: Build wheels on linux-arm64
runs-on: [self-hosted, ARM64, Linux]
container:
image: python:3.12-slim
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip conan setuptools wheel
brew install swig
- name: Build wheel
env:
QX_CPU_COMPATIBILITY_MODE: "True"
NPROCS: 10
run: python setup.py bdist_wheel
- name: Wheel path
id: wheel
working-directory: pybuild/dist/
- name: Install docker
run: |
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_OUTPUT
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: pypi-macos-arm64-py${{ matrix.python }}
path: pybuild/dist/${{ env.WHEEL_NAME }}
- uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: pybuild/dist/${{ env.WHEEL_NAME }}
asset_name: ${{ env.WHEEL_NAME }}
asset_content_type: application/zip
apt-get update
apt-get install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
manylinux-x64:
name: PyPI wheels for Manylinux (x64)
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux${{ matrix.manylinux }}_x86_64:latest
env:
SWIG_VERSION: ${{ matrix.swig_version }}
strategy:
matrix:
manylinux:
- "_2_28"
cpython_version:
- "cp38-cp38"
- "cp39-cp39"
- "cp310-cp310"
- "cp311-cp311"
- "cp312-cp312"
include:
- manylinux: _2_28
swig_version: 'swig-3.0.12-19.module_el8.3.0+6167+838326ab'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce-cli
- name: Install cibuildwheel and build wheels
run: |
dnf install -y $SWIG_VERSION
export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH"
python -m pip install --upgrade pip conan wheel auditwheel
- name: Build wheel
pip install cibuildwheel==2.18.1
cibuildwheel --output-dir wheelhouse
env:
QX_CPU_COMPATIBILITY_MODE: "True"
NPROCS: 5
run: |
export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH"
conan remove -c "*/*"
/opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel
/opt/python/${{ matrix.cpython_version }}/bin/python -m auditwheel repair pybuild/dist/*.whl
- name: Wheel path
id: wheel
working-directory: wheelhouse
run: |
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_OUTPUT
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_ENV
CIBW_BEFORE_ALL_LINUX: yum install -y java-11-openjdk
- uses: actions/upload-artifact@v4
with:
name: pypi-linux-x64-${{ matrix.cpython_version }}
path: wheelhouse/${{ env.WHEEL_NAME }}
- uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: wheelhouse/${{ env.WHEEL_NAME }}
asset_name: ${{ env.WHEEL_NAME }}
asset_content_type: application/zip
name: cibw-wheels-linux-arm64
path: ./wheelhouse/*.whl

manylinux-arm64:
name: PyPI wheels for Manylinux (arm64)
runs-on:
- "self-hosted"
- "ARM64"
- "Linux"
container: quay.io/pypa/manylinux${{ matrix.manylinux }}_aarch64:latest
env:
JAVA_VERSION: ${{ matrix.java_version }}
SWIG_VERSION: ${{ matrix.swig_version }}
strategy:
matrix:
manylinux:
- "_2_28"
cpython_version:
- "cp38-cp38"
- "cp39-cp39"
- "cp310-cp310"
- "cp311-cp311"
- "cp312-cp312"
# We are having problems when zulu-opendjk Conan package on an armv8 architecture.
# zulu-openjdk provides the Java JRE required by the ANTLR generator.
# So, for the time being, we are installing Java manually for this platform
include:
- manylinux: _2_28
java_version: 'java-11-openjdk-11.0.21.0.9-2.el8'
swig_version: 'swig-3.0.12-19.module_el8.4.0+2254+838326ab'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
dnf install -y $JAVA_VERSION $SWIG_VERSION
export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH"
python -m pip install --upgrade pip conan wheel auditwheel
- name: Build wheel
env:
QX_CPU_COMPATIBILITY_MODE: "True"
NPROCS: 5
# We clean the Conan cache as a preventive measure for our runs in self-hosted runners
# Self-hosted runners use containers that cache Conan packages from previous runs,
# and that can cause different type of problems
run: |
export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH"
conan remove -c "*/*"
python setup.py bdist_wheel
python -m auditwheel repair pybuild/dist/*.whl
- name: Wheel path
id: wheel
working-directory: wheelhouse
run: |
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_OUTPUT
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: pypi-linux-arm64-${{ matrix.cpython_version }}
path: wheelhouse/${{ env.WHEEL_NAME }}
- uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: wheelhouse/${{ env.WHEEL_NAME }}
asset_name: ${{ env.WHEEL_NAME }}
asset_content_type: application/zip

windows-x64:
name: PyPI wheels for Windows
runs-on: windows-latest
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: python -m pip install --upgrade pip conan setuptools wheel
- name: Build wheel
env:
QX_CPU_COMPATIBILITY_MODE: "True"
NPROCS: 5
run: python setup.py bdist_wheel
- name: Wheel path
id: wheel
working-directory: pybuild/dist/
run: |
echo "WHEEL_NAME=$(Get-ChildItem -name *.whl)" >> $env:GITHUB_OUTPUT
echo "WHEEL_NAME=$(Get-ChildItem -name *.whl)" >> $env:GITHUB_ENV
shell: powershell
- uses: actions/upload-artifact@v4
with:
name: pypi-windows-py${{ matrix.python }}
path: pybuild/dist/${{ env.WHEEL_NAME }}
- uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: pybuild/dist/${{ env.WHEEL_NAME }}
asset_name: ${{ env.WHEEL_NAME }}
asset_content_type: application/zip

publish:
name: Publish
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
publish-python-packages:
name: Publish Python packages
needs:
- macos-x64
- macos-arm64
- manylinux-x64
- manylinux-arm64
- windows-x64
- cibw-wheels
- cibw-wheels-linux-arm64
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
id: download
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: ${{ steps.download.outputs.download-path }}/pypi-*
packages_dir: ${{ steps.download.outputs.download-path }}/cibw-*
Loading

0 comments on commit ca10380

Please sign in to comment.