Skip to content

Update to pybind11-stubgen 2.x #634

Update to pybind11-stubgen 2.x

Update to pybind11-stubgen 2.x #634

Workflow file for this run

---
name: dist
on:
pull_request:
push:
branches:
- main
tags:
- '*'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
# This job limits concurrency on the default branch
# - we want it to run so it can populate ccache, but we typically
# don't care about when it completes, so limit its concurrency
# to stop eating up valuable + slow Windows/macOS runners
setup_concurrency:
runs-on: ubuntu-latest
outputs:
max-parallel: ${{ steps.max-parallel.outputs.p }}
steps:
- name: Setup concurrency
shell: bash
id: max-parallel
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "PARALLEL=1"
echo "p={\"v\": 1}" >> $GITHUB_OUTPUT
else
echo "PARALLEL=10000"
echo "p={\"v\": 10000}" >> $GITHUB_OUTPUT
fi
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
check-doc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Sphinx
run: |
pip --disable-pip-version-check install -e .
pip --disable-pip-version-check install -r docs/requirements.txt
cd docs && make clean html SPHINXOPTS="-W --keep-going"
test:
runs-on: ${{ matrix.os }}
needs: [setup_concurrency]
strategy:
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
matrix:
os: [windows-latest, macos-latest, ubuntu-20.04]
python_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
architecture: [x86, x64]
exclude:
- os: macos-latest
architecture: x86
- os: ubuntu-20.04
architecture: x86
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.architecture }}
- name: Set ccache variant
shell: bash
id: ccache
run: |
if [[ "${{ matrix.os }}" == windows-* ]]; then
echo "VARIANT=sccache" >> $GITHUB_OUTPUT
else
echo "VARIANT=ccache" >> $GITHUB_OUTPUT
fi
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.python_version }}
variant: ${{ steps.ccache.outputs.variant }}
- name: Install build
run: python -m pip --disable-pip-version-check install build
- name: Build wheel
run: python -m build --wheel
- name: Install
shell: bash
working-directory: dist
run: python -m pip --disable-pip-version-check install *.whl
- name: Install test dependencies
shell: bash
working-directory: tests
run: python -m pip --disable-pip-version-check install -r requirements.txt
- name: Test wheel
shell: bash
env:
RPYBUILD_PARALLEL: 1
RPYBUILD_STRIP_LIBPYTHON: 1
RPYBUILD_CC_LAUNCHER: ${{ steps.ccache.outputs.variant }}
working-directory: tests
run: |
python run_tests.py
cross-build:
runs-on: ubuntu-latest
needs: [setup_concurrency]
strategy:
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
matrix:
container:
- robotpy/roborio-cross-ubuntu:2023.1
- robotpy/raspbian-cross-ubuntu:2023.1
container:
image: "${{ matrix.container }}"
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: apt-get update
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.container }}
- name: Install build
run: /build/venv/bin/build-pip --disable-pip-version-check install build
- name: Build wheel
run: /build/venv/bin/build-python -m build --wheel
- name: Install
working-directory: dist
run: |
# install to both cross and build in case things get mixed up
/build/venv/bin/build-pip --disable-pip-version-check install *.whl
/build/venv/bin/cross-pip --disable-pip-version-check install *.whl
- name: Build cross wheel
env:
RPYBUILD_PARALLEL: 1
RPYBUILD_STRIP_LIBPYTHON: 1
RPYBUILD_CC_LAUNCHER: ccache
working-directory: tests/cpp
run: /build/venv/bin/cross-python run_install.py wheel
publish:
runs-on: ubuntu-latest
needs: [check, check-doc, test]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
- run: pip --disable-pip-version-check install build
- name: Build packages
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}