ci: Make aarch64 workflow a little nicer #375
Workflow file for this run
This file contains hidden or 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
| on: [push, pull_request] | |
| jobs: | |
| build_src: | |
| name: Build sdist | |
| runs-on: ubuntu-latest | |
| outputs: | |
| rel0: ${{ steps.query.outputs.rel0 }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| submodules: recursive | |
| - name: Query PyPI for recent PySide release number | |
| id: query | |
| run: python ./scripts/get-recent-releases.py 3 >> $GITHUB_OUTPUT | |
| - name: Build sdist | |
| env: | |
| PIP_EXTRA_INDEX_URL: https://download.qt.io/official_releases/QtForPython/ | |
| PYSIDE6_QTADS_NO_HARD_PYSIDE_REQUIREMENT: 1 | |
| run: | | |
| python -m pip install --user build | |
| python -m build --sdist | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: source | |
| path: dist/*.tar.gz | |
| # FIXME: Automate minimum Python, manylinux, and custom auditwheel lib filter | |
| build_wheels: | |
| needs: build_src | |
| name: Build wheel ${{ matrix.wheel }} for PySide ${{ matrix.pyside_ver }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-2022 | |
| pyside_ver: ${{ needs.build_src.outputs.rel0 }} | |
| wheel: cp39-win_amd64 | |
| arch: x86_64 | |
| - os: ubuntu-latest | |
| pyside_ver: ${{ needs.build_src.outputs.rel0 }} | |
| wheel: cp39-manylinux_x86_64 | |
| arch: x86_64 | |
| - os: macos-13 | |
| pyside_ver: ${{ needs.build_src.outputs.rel0 }} | |
| wheel: cp39-macosx_x86_64 | |
| arch: x86_64 | |
| - os: macos-13 | |
| pyside_ver: ${{ needs.build_src.outputs.rel0 }} | |
| wheel: cp39-macosx_arm64 | |
| arch: arm64 | |
| steps: | |
| - name: Setup Python | |
| if: runner.os == 'Windows' | |
| uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Download sdist | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 | |
| with: | |
| name: source | |
| - name: Unpack sdist | |
| shell: bash | |
| run: tar --strip-components 1 -xvf *.tar.gz | |
| - name: Setup Qt vars | |
| shell: bash | |
| run: | | |
| QT_VERSION=$(echo ${{ matrix.pyside_ver }} | cut -d. -f-3) | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| QT_BASE_DIR=${GITHUB_WORKSPACE}\\Qt | |
| QT6_DIR=$QT_BASE_DIR\\$QT_VERSION\\msvc2022_64 | |
| elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
| QT_BASE_DIR=${GITHUB_WORKSPACE}/Qt | |
| QT6_DIR=$QT_BASE_DIR/$QT_VERSION/macos | |
| elif [[ "$RUNNER_OS" == "Linux" ]]; then | |
| QT_BASE_DIR=${GITHUB_WORKSPACE}/Qt | |
| QT6_DIR=$QT_BASE_DIR/$QT_VERSION/gcc_64 | |
| else | |
| echo "Unsupported runner OS $RUNNER_OS" | |
| exit 1 | |
| fi | |
| echo "QT_VERSION=$QT_VERSION" >> $GITHUB_ENV | |
| echo "QT_BASE_DIR=$QT_BASE_DIR" >> $GITHUB_ENV | |
| echo "QT6_DIR=$QT6_DIR" >> $GITHUB_ENV | |
| - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 | |
| if: runner.os == 'Windows' | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 | |
| with: | |
| output-dir: wheelhouse | |
| env: | |
| CIBW_ENVIRONMENT_LINUX: > | |
| CMAKE_PREFIX_PATH=${{ env.QT6_DIR }}/lib/cmake | |
| LD_LIBRARY_PATH=${{ env.QT6_DIR }}/lib | |
| PIP_EXTRA_INDEX_URL=https://download.qt.io/official_releases/QtForPython/ | |
| VERBOSE=1 | |
| CIBW_ENVIRONMENT_MACOS: > | |
| MACOSX_DEPLOYMENT_TARGET=11.0 | |
| CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} | |
| CMAKE_PREFIX_PATH=${QT6_DIR}/lib/cmake | |
| PIP_EXTRA_INDEX_URL=https://download.qt.io/official_releases/QtForPython/ | |
| VERBOSE=1 | |
| CIBW_ENVIRONMENT_WINDOWS: > | |
| CMAKE_PREFIX_PATH="${QT6_DIR}\\lib\\cmake" | |
| PIP_EXTRA_INDEX_URL=https://download.qt.io/official_releases/QtForPython/ | |
| VERBOSE=1 | |
| CIBW_BEFORE_BUILD_LINUX: > | |
| rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux | |
| && yum install -y mesa-libGL libxslt llvm clang clang-devel libxkbcommon-devel | |
| && python3 -m pip install --user "aqtinstall!=3.2.1" auditwheel | |
| && python3 -m aqt install-qt linux desktop ${{ env.QT_VERSION }} --outputdir ${{ env.QT_BASE_DIR }} --base http://mirrors.ocf.berkeley.edu/qt/ | |
| && python3 ./scripts/set-qt-constraint.py ${{ matrix.pyside_ver }} | |
| CIBW_BEFORE_BUILD_MACOS: > | |
| python3 -m pip install "aqtinstall!=3.2.1" | |
| && python3 -m aqt install-qt mac desktop ${{ env.QT_VERSION }} --outputdir ${{ env.QT_BASE_DIR }} --base http://mirrors.ocf.berkeley.edu/qt/ | |
| && python3 ./scripts/set-qt-constraint.py ${{ matrix.pyside_ver }} | |
| CIBW_BEFORE_BUILD_WINDOWS: > | |
| python3 -m pip install "aqtinstall!=3.2.1" | |
| && python3 -m aqt install-qt windows desktop ${{ env.QT_VERSION }} win64_msvc2022_64 --outputdir ${{ env.QT_BASE_DIR }} --base http://mirrors.ocf.berkeley.edu/qt/ | |
| && python3 ./scripts/set-qt-constraint.py ${{ matrix.pyside_ver }} | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_ARCHS_MACOS: x86_64 arm64 | |
| CIBW_BUILD_VERBOSITY: 3 | |
| CIBW_BUILD: ${{ matrix.wheel }} | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: > | |
| python ./scripts/custom-auditwheel.py repair -w {dest_dir} --only-plat --plat manylinux_2_28_x86_64 {wheel} | |
| CIBW_REPAIR_WHEEL_COMMAND_MACOS: | |
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: | |
| # - name: Rename wheel to include Qt version | |
| # run: | | |
| # pushd wheelhouse | |
| # for i in *.whl; do | |
| # pkgname=$(echo $i | cut -d- -f1-2) | |
| # pkginfo=$(echo $i | cut -d- -f3-) | |
| # mv $i ${pkgname}-${{ matrix.pyside_ver }}-${pkginfo} | |
| # done | |
| # popd | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: wheel-${{ matrix.wheel }} | |
| path: ./wheelhouse/*.whl | |
| build_aarch64_wheel: | |
| name: Build wheel ${{ matrix.wheel }} for PySide ${{ matrix.pyside_ver }} on ${{ matrix.os }} | |
| needs: build_src | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04-arm | |
| pyside_ver: ${{ needs.build_src.outputs.rel0 }} | |
| wheel: cp39-manylinux_aarch64 | |
| arch: aarch64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Download sdist | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 | |
| with: | |
| name: source | |
| - name: Unpack sdist | |
| shell: bash | |
| run: tar --strip-components 1 -xvf *.tar.gz | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| libgl1-mesa-dev \ | |
| libxslt1-dev git \ | |
| libglib2.0-dev \ | |
| patchelf \ | |
| python-is-python3 \ | |
| python3 \ | |
| python3-venv \ | |
| python3-pip \ | |
| libxkbcommon-dev | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@c7f87aa956e4c323abf06d5dec078e358f6b4d04 # v6 | |
| with: | |
| activate-environment: true | |
| - name: Install Python dependencies | |
| run: uv pip install "aqtinstall!=3.2.1" PySide6 auditwheel | |
| - name: Setup Qt vars | |
| shell: bash | |
| run: echo QT_VERSION=$(echo ${{ matrix.pyside_ver }} | cut -d. -f-3) >> $GITHUB_ENV | |
| - name: Install Qt | |
| run: aqt install-qt linux_arm64 desktop ${{ env.QT_VERSION }} --outputdir qt | |
| - name: Build | |
| env: | |
| LD_LIBRARY_PATH: ${{ github.workspace }}/qt/${{ env.QT_VERSION }}/gcc_arm64/lib | |
| CMAKE_PREFIX_PATH: ${{ github.workspace }}/qt/${{ env.QT_VERSION }}/gcc_arm64/lib/cmake | |
| PIP_EXTRA_INDEX_URL: https://download.qt.io/official_releases/QtForPython/ | |
| run: uv build --verbose --wheel . | |
| - name: Fixup wheel | |
| env: | |
| LD_LIBRARY_PATH: ${{ env.VIRTUAL_ENV }}/lib/python3.12/site-packages/PySide6/ | |
| run: | | |
| mkdir dist-repaired | |
| python ./scripts/custom-auditwheel.py repair -w dist-repaired --only-plat --plat manylinux_2_39_aarch64 ./dist/pyside6_qtads-*.whl | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: wheel-${{ matrix.wheel }} | |
| path: ./dist-repaired/*.whl | |
| upload_pypi: | |
| needs: [build_wheels, build_aarch64_wheel, build_src] | |
| runs-on: ubuntu-latest | |
| # upload to PyPI on every tag starting with 'v' | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 | |
| with: | |
| name: source | |
| path: dist | |
| - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 | |
| with: | |
| pattern: wheel-* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} |