Switch to cibuildwheel #21
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: 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-latest | |
- os: windows-latest | |
- os: macos-13 # Intel | |
- os: macos-14 # Apple Silicon | |
steps: | |
- uses: ilammy/msvc-dev-cmd@v1 | |
if: runner.os == 'Windows' | |
with: | |
arch: amd64 | |
- uses: actions/checkout@v4 | |
- 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="$GITHUB_WORKSPACE\Qt\${{ env.PYSIDE_VERSION }}\windows\bin;$PATH" | |
CIBW_ENVIRONMENT_MACOS: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} MACOSX_DEPLOYMENT_TARGET='11.7' PATH=$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=$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 "$GITHUB_WORKSPACE"/Qt mac desktop ${{ env.PYSIDE_VERSION }} | |
CIBW_BEFORE_BUILD_LINUX: > | |
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux | |
&& dnf install -y mesa-libGL libxslt llvm clang-libs | |
&& pip install "aqtinstall" && aqt install-qt -O "$GITHUB_WORKSPACE"/Qt linux desktop ${{ env.PYSIDE_VERSION }} | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
CIBW_SKIP: "*-win32 *i686" | |
- 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 |