Skip to content

Commit

Permalink
Switch to cibuildwheel
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
  • Loading branch information
jeandet committed Mar 10, 2024
1 parent 715ef17 commit 1cf35af
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 212 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: GH Actions

on:
release:
types: [published]
push:
pull_request:

env:
PYSIDE_VERSION: 6.6.2
PIP_EXTRA_INDEX_URL: "https://download.qt.io/official_releases/QtForPython/"

jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: |
sudo apt update && sudo apt install -y libgl-dev
pip install aqtinstall
aqt install-qt -O "$GITHUB_WORKSPACE"/Qt linux desktop ${{ env.PYSIDE_VERSION }}
PATH="$GITHUB_WORKSPACE"/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/bin:$PATH" LD_LIBRARY_PATH="$GITHUB_WORKSPACE"/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/lib:$LD_LIBRARY_PATH" pipx run build --sdist
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: cibw-sdist
path: dist/*.tar.gz

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest7
arch: x86_64
- os: windows-latest
arch: x86_64
- os: macos-13 # Intel
arch: x86_64
- os: macos-14 # Apple Silicon
arch: arm64
steps:
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
with:
arch: amd64
- uses: actions/checkout@v4
- name: Forward GITHUB_WORKSPACE env var
shell: bash
run: |
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
PYSIDE_VERSION: ${{ env.PYSIDE_VERSION }}
PIP_EXTRA_INDEX_URL: ${{ env.PIP_EXTRA_INDEX_URL }}
CIBW_ENVIRONMENT_WINDOWS: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} PATH="${{ env.GITHUB_WORKSPACE }}\\Qt\\${{ env.PYSIDE_VERSION }}\\windows\\bin;$PATH"
CIBW_ENVIRONMENT_MACOS: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} MACOSX_DEPLOYMENT_TARGET='11.0' PATH=${{ env.GITHUB_WORKSPACE }}/Qt/${{ env.PYSIDE_VERSION }}/macos/bin:$PATH
CIBW_ENVIRONMENT_LINUX: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} PATH=$GITHUB_WORKSPACE/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/bin:$PATH LD_LIBRARY_PATH=${{ env.GITHUB_WORKSPACE }}/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/lib:$LD_LIBRARY_PATH
CIBW_BEFORE_BUILD_WINDOWS: >
pip install "aqtinstall"
&& aqt install-qt -O ${{ env.GITHUB_WORKSPACE }}\\Qt windows desktop ${{ env.PYSIDE_VERSION }} win64_msvc2019_64
CIBW_BEFORE_BUILD_MACOS: >
pip install "aqtinstall"
&& aqt install-qt -O "${{ env.GITHUB_WORKSPACE }}/Qt" mac desktop ${{ env.PYSIDE_VERSION }}
CIBW_BEFORE_BUILD_LINUX: >
dnf install -y /usr/lib64/libxkbcommon.so.0 /usr/lib64/libxslt.so.1 /usr/bin/llvm-config clang
&& pip install "aqtinstall" && aqt install-qt -O "${{ env.GITHUB_WORKSPACE }}/Qt" linux desktop ${{ env.PYSIDE_VERSION }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_SKIP: "*-win32 *i686 *38-macosx*"
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCH: ${{ matrix.arch }}

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl


upload_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
# upload to PyPI only on github releases
if: github.event_name == 'release' && github.event.action == 'published' && github.repository_owner == 'SciQLop'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
skip-existing: true

upload_test_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
# upload to test PyPI on github pushes
if: github.event_name == 'push' && github.repository_owner == 'SciQLop'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_PASSWORD }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
54 changes: 0 additions & 54 deletions .github/workflows/pythonpublish-linux.yml

This file was deleted.

100 changes: 0 additions & 100 deletions .github/workflows/pythonpublish-osx.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/pythonpublish-win.yml

This file was deleted.

4 changes: 1 addition & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ qt_sdk='qt6'
extra_files=files(
'pyproject.toml',
'setup.cfg',
'.github/workflows/pythonpublish-linux.yml',
'.github/workflows/pythonpublish-win.yml',
'.github/workflows/pythonpublish-osx.yml',
'.github/workflows/build_wheels.yml',
'README.md', 'COPYING'
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = [
"wheel",
"ninja",
"numpy",
"numpy<=1.24.4",
"meson-python>=0.14.0",
"meson",
"shiboken6==6.6.2",
Expand Down

0 comments on commit 1cf35af

Please sign in to comment.