Skip to content

CI

CI #194

Workflow file for this run

name: CI
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
schedule:
# cron is kinda random, assumes 22:00 UTC is a low ebb, eastern
# countries are very early morning, and US are mid-day to
# mid-afternoon
- cron: '0 22 * * 2'
jobs:
checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout working copy
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install checkers
run: |
python -mpip install --upgrade pip
python -mpip install black flake8
- name: flake
run: flake8 .
- name: black
run: black --check --diff --color --quiet .
# REPLACE BY: job which python -mbuild, and uploads the sdist and wheel to artifacts
# build is not binary so can just build the one using whatever python version
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout working copy
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependency
run: |
python -mpip install --upgrade pip
python -mpip install build
- name: Build sdist and wheel
run: |
python -mbuild
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz
retention-days: 1
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: wheel
path: dist/*.whl
retention-days: 1
test:
runs-on: ubuntu-latest
needs: compile
continue-on-error: ${{ matrix.python-version == '3.13' || matrix.python-version == 'pypy-3.11' }}
strategy:
fail-fast: false
matrix:
source:
- wheel
- sdist
- source
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
- "pypy-3.11"
include:
- source: sdist
artifact: dist/*.tar.gz
- source: wheel
artifact: dist/*.whl
steps:
- name: Checkout working copy
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install test dependencies
run: |
python -mpip install --upgrade pip
# if binary wheels are not available for the current package install libyaml
# NB: cyaml is outright broken on pypy so exclude that
if ! ${{ startsWith(matrix.python-version, 'pypy-') }}; then
if ! pip download --only-binary pyyaml -rrequirements_dev.txt > /dev/null 2>&1; then
sudo apt install libyaml-dev
fi
fi
python -mpip install pytest pyyaml
- name: download ${{ matrix.source }} artifact
if: matrix.artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.source }}
path: dist/
- name: install package in environment
run: |
pip install ${{ matrix.artifact || '.' }}
- name: run tests
run: pytest -v -Werror -Wignore::ImportWarning --doctest-glob="*.rst"