From eb47a3c73156e4974b29c201705ffff0438f56a0 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 21 Jun 2024 13:34:40 +0100 Subject: [PATCH 1/2] Refactor build wheel CI --- .github/workflows/build.yml | 53 ++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6685f67..aebad23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,20 +31,25 @@ jobs: if-no-files-found: error build_wheels: - name: Build wheel on ${{ matrix.os }} + name: Build wheel on ${{ matrix.os }} for ${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - # Include macos-13 to get Intel x86_64 macs and maos-latest to get the Aaarch64 macs - os: [ubuntu-latest, macos-latest, macos-13, windows-2022] - - # Build on the native architectures (macos-latest is arm64. macos-13 is x86_64) include: - - os: macos-latest - osx_arch: 'arm64' - - os: macos-13 - osx_arch: 'x86_64' + - os: ubuntu-latest + cibw_archs: "x86_64" + # TBD to enable arm64 wheels on Linux + #- os: ubuntu-20.04 + # cibw_archs: "aarch64" + - os: windows-2022 + cibw_archs: "auto64" + # Include macos-13 to get Intel x86_64 macs and maos-latest to get the Aaarch64 macs + - os: macos-13 + cibw_archs: "x86_64" + - os: macos-latest + cibw_archs: "arm64" + steps: - uses: actions/checkout@master with: @@ -69,6 +74,7 @@ jobs: uses: pypa/cibuildwheel@v2.19.1 env: CIBW_BUILD: "cp3*" + CIBW_ARCHS: ${{ matrix.cibw_archs }} CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*" CIBW_MANYLINUX_X86_64_IMAGE: "dockcross/manylinux2014-x64" CIBW_TEST_REQUIRES: "pytest" @@ -79,45 +85,32 @@ jobs: CIBW_BEFORE_BUILD: >- rm -rf {package}/c/build CIBW_ENVIRONMENT_LINUX: CMAKE_GENERATOR="Unix Makefiles" - CIBW_ENVIRONMENT_MACOS: CMAKE_GENERATOR="Unix Makefiles" CMAKE_OSX_ARCHITECTURES=${{ matrix.osx_arch }} + CIBW_ENVIRONMENT_MACOS: CMAKE_GENERATOR="Unix Makefiles" CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw_archs }} CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR="Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM=x64 CIBW_BUILD_VERBOSITY: 1 - name: Upload artifacts to github uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix.os }} + name: wheels-${{ runner.os }}-${{ matrix.cibw_archs }} path: ./wheelhouse/*.whl if-no-files-found: error - - merge_wheel_artifacts: - name: Merge wheel artifacts - runs-on: ubuntu-latest - needs: [build_sdist, build_wheels] - steps: - - name: Merge artifacts - uses: actions/upload-artifact/merge@v4 - with: - name: wheels - pattern: wheels-* - delete-merged: true - - publish_to_pypi: name: Publish wheels to PyPi if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - needs: merge_wheel_artifacts + needs: [build_sdist, build_wheels] runs-on: ubuntu-latest steps: - name: Download packages uses: actions/download-artifact@v4 with: - pattern: wheels* - path: wheelhouse + pattern: wheels-* + path: dist + merge-multiple: true - name: Print out packages - run: ls wheelhouse + run: ls -la dist/* - name: Upload wheels to pypi env: @@ -125,4 +118,4 @@ jobs: TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | python -m pip install --upgrade twine - twine upload wheelhouse/* + twine upload dist/* From a02c74a7f23753854be814cf76ac7990df76d3d6 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 21 Jun 2024 16:18:11 +0100 Subject: [PATCH 2/2] Add Linux aarch64 build --- .github/workflows/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aebad23..a156216 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,8 @@ jobs: include: - os: ubuntu-latest cibw_archs: "x86_64" - # TBD to enable arm64 wheels on Linux - #- os: ubuntu-20.04 - # cibw_archs: "aarch64" + - os: ubuntu-latest + cibw_archs: "aarch64" - os: windows-2022 cibw_archs: "auto64" # Include macos-13 to get Intel x86_64 macs and maos-latest to get the Aaarch64 macs @@ -55,6 +54,13 @@ jobs: with: submodules: 'recursive' + # This might not be necessary once ARM runners become available for general use + - name: Set up QEMU + if: matrix.cibw_archs == 'aarch64' + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 if: startsWith(matrix.os,'windows')