Skip to content

refactor actions

refactor actions #55

name: Build and upload
on:
push:
branches: master
paths:
- "setup.py"
- .github/workflows/build-and-upload.yml
jobs:
testing:
uses: ./.github/workflows/test.yml
build_linux_macos_wheels:
needs: testing
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install build and pip
run: python -m pip install -U pip build
shell: bash
- name: Build Sdist
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
python -m build --sdist
fi
shell: bash
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Install Cibuildwheel
run: python -m pip install cibuildwheel
shell: bash
- name: Build Wheels
env:
CIBW_BEFORE_BUILD: pip install -U pip
CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_LINUX: auto aarch64
run: |
python -m cibuildwheel --output-dir wheelhouse
ls wheelhouse/*
shell: bash
- name: Upload Builds
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install twine
if [ "$RUNNER_OS" == "Linux" ]; then
# Replace/remove echo
python -m twine upload --skip-existing dist/*
fi
python -m twine upload --skip-existing wheelhouse/*.whl
shell: bash
build_win32_wheels:
needs: testing
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Cibuildwheel
run: python -m pip install cibuildwheel
shell: bash
- name: Build Wheels
env:
CIBW_BEFORE_BUILD: bash ./build.sh
CIBW_SKIP: pp* *-win_amd64
CIBW_ENVIRONMENT: PLATFORM_OPTION='-A win32'
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
run: |
python -m cibuildwheel --output-dir wheelhouse
ls wheelhouse/*
shell: bash
- name: Upload Builds
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install twine
python -m twine upload --skip-existing wheelhouse/*.whl
shell: bash
build_amd64_wheels:
needs: testing
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Cibuildwheel
run: python -m pip install cibuildwheel
shell: bash
- name: Build Wheels
env:
CIBW_BEFORE_BUILD: bash ./build.sh
CIBW_SKIP: pp* *-win32
CIBW_ENVIRONMENT: PLATFORM_OPTION='-A x64'
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
run: |
python -m cibuildwheel --output-dir wheelhouse
ls wheelhouse/*
shell: bash
- name: Upload Builds
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install twine
python -m twine upload --skip-existing wheelhouse/*.whl
shell: bash