Skip to content

Update CI/CD workflows, setup config files, and build wheels for Python >= 3.8 #1485

Update CI/CD workflows, setup config files, and build wheels for Python >= 3.8

Update CI/CD workflows, setup config files, and build wheels for Python >= 3.8 #1485

Workflow file for this run

---
name: Test Python library
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
FORCE_COLOR: '1' # Make tools pretty.
PIP_DISABLE_PIP_VERSION_CHECK: '1'
PIP_NO_PYTHON_VERSION_WARNING: '1'
PYTHON_LATEST: '3.11'
# For re-actors/checkout-python-sdist
sdist-artifact: python-package-distributions
jobs:
lint:
name: Check linting
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- run: |
python -m pip install build
python -m pip install -r requirements/test.txt
name: Install core libraries for build and install
- name: Run linting checks
run: scripts/check
test-pytest:
name: 'Python ${{ matrix.python-version }}/Cython: ${{ matrix.use-cython }}'
runs-on: ubuntu-latest
timeout-minutes: 10 # Maybe we should remove this someday but the PyPy tests are acting strange
strategy:
# Complete all jobs even if one fails, allows us to see
# for example if a test fails only when Cython is enabled
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
use-cython: ['true', 'false']
experimental: [false]
# include:
# - python-version: pypy3.9
# experimental: true
# use-cython: 'false'
# - python-version: ~3.12.0-0
# experimental: true
# use-cython: 'false'
env:
USE_CYTHON: ${{ matrix.use-cython }}
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements/test.txt
- name: Install dependencies
run: |
pip install -r requirements/test.txt
pip install .
- name: Run tests
run: scripts/tests
- name: Enforce coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
check: # This job does nothing and is only used for the branch protection
name: ✅ Ensure the required checks passing
if: always()
needs: [lint, test-pytest]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}