From 0012857dfbf1fcea462554d27b7231b0588a3b39 Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Tue, 7 May 2024 13:22:25 +0000 Subject: [PATCH] use pypa/cibuildwheel action --- .github/workflows/deploy-python.yml | 66 +++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy-python.yml b/.github/workflows/deploy-python.yml index 2979ac2..c8dc724 100644 --- a/.github/workflows/deploy-python.yml +++ b/.github/workflows/deploy-python.yml @@ -13,6 +13,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: @@ -20,32 +22,60 @@ jobs: - name: Test fizzbuzzo3 run: cargo test --package fizzbuzzo3 + + wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build wheels + uses: pypa/cibuildwheel@v2.17.0 + env: + CIBW_CONFIG_SETTINGS: "--build-option=--py-limited-api=cp38" + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + sdist: + name: Make SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build SDist + run: pipx run build --sdist + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + publish: environment: ADO-Packages - needs: [python-checks, rust-checks] + needs: [python-checks, rust-checks, wheels, sdist] runs-on: ubuntu-latest - container: quay.io/pypa/manylinux2014_x86_64 steps: - - uses: actions/checkout@v4 - - name: Setup Rust - uses: actions-rs/toolchain@v1 + - uses: actions/download-artifact@v4 with: - profile: minimal - toolchain: stable - - name: Build cp38-abi3 sdist - run: python3.8 -m build --config-setting=--build-option=--py-limited-api=cp38 - - name: Auditwheel - run: | - for whl in dist/*linux*.whl; do - auditwheel repair "$whl" - done \ - && rm -f dist/*linux*.whl \ - && mv wheelhouse/* dist + pattern: cibw-* + path: dist + merge-multiple: true - name: Install ADO tooling - run: python3.12 -m pip install keyring artifacts-keyring + run: python -m pip install keyring artifacts-keyring - name: Upload to ADO env: TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/MusicalNinjas/FizzBuzz/_packaging/FizzBuzz/pypi/upload/ TWINE_USERNAME: FizzBuzz TWINE_PASSWORD: ${{ secrets.ADO_TOKEN }} - run: python3.12 -m twine upload --non-interactive dist/* \ No newline at end of file + run: twine upload --non-interactive dist/* \ No newline at end of file