Attempt to build a single architecture wheel for Windows #312
Workflow file for this run
This file contains 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
name: Build, test and upload to PyPI | |
# Build on every branch push, tag push, and pull request change: | |
on: [push, pull_request] | |
jobs: | |
doctest: | |
name: All tests, on current Python | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Build the libpg_query library | |
run: | | |
make -C libpg_query build | |
- name: Build the extension module | |
run: | | |
python setup.py build_ext --inplace | |
- name: Install the module itself in development mode | |
run: | | |
python -m pip install -e . | |
- name: Execute the test suite | |
run: | | |
python -m pytest --cov-report=xml tests/ | |
make -C docs doctest | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
build_wheels: | |
name: Build wheels on ${{ matrix.arch }} for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-12, windows-2022] | |
arch: [auto] | |
include: | |
- os: ubuntu-22.04 | |
arch: aarch64 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up QEMU | |
if: ${{ matrix.arch == 'aarch64' }} | |
uses: docker/setup-qemu-action@v3 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
env: | |
CIBW_TEST_REQUIRES: "coverage pytest pytest-cov" | |
CIBW_TEST_COMMAND: "py.test {project}/tests" | |
CIBW_SKIP: "cp2* cp33* cp34* cp35* cp36* cp37* cp38* pp* cp*-win_x86" | |
CIBW_ARCHS: ${{matrix.arch}} | |
CIBW_PRERELEASE_PYTHONS: True | |
CIBW_BEFORE_BUILD_WINDOWS: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 | |
set DISTUTILS_USE_SDK=1 | |
set MSSdk=1 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-for-${{ matrix.os }}-${{ matrix.arch }} | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
name: Upload wheels to PyPI | |
needs: build_wheels | |
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@v4 | |
with: | |
path: dist | |
pattern: wheels-for-* | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |