Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

CI

CI #805

Workflow file for this run

name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events.
push: {}
pull_request: {}
release:
types: [ published ]
# Run the pipeline daily so that we get continuous dogfooding and coverage of the latest Python
# and PyTest patch versions.
schedule:
# Run at 6pm UTC/10am Pacific
- cron: 0 18 * * *
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: { }
defaults:
run:
shell: bash -eo pipefail {0}
jobs:
check:
name: Typecheck, lint, and check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
id: install
run: |
python -m pip install --upgrade pip
pip install tox==4.0.1
- name: Typecheck
run: tox -e mypy
- name: Lint
if: ${{ always() && steps.install.outcome == 'success' }}
run: tox -e flake8
- name: Check code style
if: ${{ always() && steps.install.outcome == 'success' }}
run: tox -e pycodestyle
- name: Build PyPI package
if: ${{ always() && steps.install.outcome == 'success' }}
run: |
pip install build==0.9.0 twine==4.0.2
python -m build
pytest_integration_tests:
name: "PyTest Integration Tests: py${{ matrix.python }}-${{ matrix.tox_env }}-${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs:
# Don't incur the cost of the test matrix if the basic build fails.
- check
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
tox_env:
- pytest62
- pytest62-xdist
- pytest70
- pytest70-xdist
- pytest71
- pytest71-xdist
- pytest72
- pytest72-xdist
- pytest73
- pytest73-xdist
- pytest74
- pytest74-xdist
- pytest80
- pytest80-xdist
- pytest81
- pytest81-xdist
- pytest82
- pytest82-xdist
exclude:
# PyTest < 7.3 uses methods that are deprecated in Python 3.12 and emits warnings that
# cause the integration tests to fail.
- python: "3.12"
tox_env: pytest62
- python: "3.12"
tox_env: pytest62-xdist
- python: "3.12"
tox_env: pytest70
- python: "3.12"
tox_env: pytest70-xdist
- python: "3.12"
tox_env: pytest71
- python: "3.12"
tox_env: pytest71-xdist
- python: "3.12"
tox_env: pytest72
- python: "3.12"
tox_env: pytest72-xdist
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox==4.0.1
- name: Test
run: |
UNFLAKABLE_API_KEY=${{ secrets.UNFLAKABLE_API_KEY }} \
tox -e ${{ matrix.tox_env }} \
--override testenv.pass_env=UNFLAKABLE_API_KEY \
--override testenv.basepython=python${{ matrix.python }} \
-- \
--enable-unflakable \
--test-suite-id 2AT4xgduQdwkVKSaO0qJ2Dqm2JY \
-s \
-v
publish:
name: Publish to PyPI
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs:
- check
- pytest_integration_tests
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build==0.9.0 twine==4.0.2
- name: Build package
run: |
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}