Skip to content

Don't build all wheels all the time #129

Don't build all wheels all the time

Don't build all wheels all the time #129

Workflow file for this run

name: Build distributions and upload to PyPI
# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]
jobs:
calculate_wheels_to_build:
name: Calculate OS/archs to build wheels on
runs-on: ubuntu-20.04
env:
BUILD_CONFIG_BASE: "\"os\": [\"ubuntu-20.04\", \"windows-2019\", \"macos-12\"], \"arch_linux\": [\"auto\"]"
BUILD_CONFIG_EXTRA: "[]"
BUILD_CONFIG_EXTRA_ON_TAGS: "[{\"os\": \"ubuntu-20.04\", \"arch_linux\": \"aarch64\"}]"
ARCHS_MACOS: 'auto'
ARCHS_MACOS_ON_TAGS: 'x86_64 arm64 universal2'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
macos_archs: ${{ startsWith(github.event.ref, 'refs/tags/v') && env.ARCHS_MACOS_ON_TAGS || env.ARCHS_MACOS }}
steps:
- name: Calculate strategy matrix
id: set-matrix
env:
MATRIX_INCLUDES: ${{ startsWith(github.event.ref, 'refs/tags/v') && env.BUILD_CONFIG_EXTRA_ON_TAGS || env.BUILD_CONFIG_EXTRA }}
run: echo "matrix={$BUILD_CONFIG_BASE, \"include\": $MATRIX_INCLUDES}" >> "$GITHUB_OUTPUT"

Check failure on line 25 in .github/workflows/deploy-to-pypi.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy-to-pypi.yml

Invalid workflow file

You have an error in your yaml syntax on line 25
build_wheels:
name: Build wheels on ${{matrix.arch}} for ${{ matrix.os }}
needs: calculate_wheels_to_build
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJson(needs.calculate_wheels_to_build.outputs.matrix) }}
env:
ARCHS_MACOS: ${{ needs.calculate_wheels_to_build.outputs.macos_archs }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.12'
- uses: docker/setup-qemu-action@v1
if: ${{ matrix.arch == 'aarch64' }}
name: Set up QEMU
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch_linux }}
CIBW_ARCHS_MACOS: ${{ env.ARCHS_MACOS }}
CIBW_BEFORE_ALL: "bash -c 'cd \"{project}\"; sh .github/tools/install_yajl.sh'"
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT_MACOS: "IJSON_EMBED_YAJL=1"
CIBW_ENVIRONMENT_WINDOWS: "IJSON_EMBED_YAJL=1"
CIBW_TEST_COMMAND: "bash -c 'cd \"{project}\"; pytest -vv'"
CIBW_TEST_REQUIRES: pytest cffi
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.12'
- name: Install setuptools
run: pip install setuptools
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}