Skip to content

Merge pull request #400 from kurtmckee/pre-commit-ci-update-config #282

Merge pull request #400 from kurtmckee/pre-commit-ci-update-config

Merge pull request #400 from kurtmckee/pre-commit-ci-update-config #282

Workflow file for this run

name: "CI"
on:
pull_request:
push:
branches:
- "develop"
- "master"
- "main"
- "releases"
jobs:
test:
name: "Test on ${{ matrix.config.os-name }}"
runs-on: "${{ matrix.config.runner }}"
strategy:
matrix:
config:
- os-name: "Linux"
runner: "ubuntu-latest"
test-label: "ci-test-linux"
- os-name: "macOS"
runner: "macos-latest"
test-label: "ci-test-macos"
- os-name: "Windows"
runner: "windows-latest"
test-label: "ci-test-windows"
fail-fast: false
steps:
- name: "Checkout the repo"
uses: "actions/checkout@v3"
- name: "Setup Python"
id: "setup-python"
uses: "actions/setup-python@v4"
with:
python-version: |
3.8
3.9
3.10
3.11
pypy-3.9
- name: "Determine month number"
shell: "bash"
run: |
date +'month-number=%m' >> $GITHUB_ENV
date +'%m' > month-number.txt
- name: "Determine venv path"
shell: "bash"
run: "echo 'venv-path=${{ matrix.config.os-name == 'Windows' && '.venv/Scripts' || '.venv/bin' }}' >> $GITHUB_ENV"
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@v3"
with:
path: |
.tox/
.venv/
key: "test-${{ matrix.config.runner }}-${{ hashFiles('pyproject.toml', 'tox.ini', 'month-number.txt') }}"
- name: "Create virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
${{ env.venv-path }}/python -m pip install --upgrade pip setuptools wheel
${{ env.venv-path }}/python -m pip install tox
- name: "Run tests"
run: "${{ env.venv-path }}/tox run -m ${{ matrix.config.test-label }}"
lint:
name: "Lint"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repo"
uses: "actions/checkout@v3"
- name: "Setup Python"
id: "setup-python"
uses: "actions/setup-python@v4"
with:
python-version: "3.11"
- name: "Determine month number"
shell: "bash"
run: "date +'%m' > month-number.txt"
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@v3"
with:
path: |
.mypy_cache/
.tox/
.venv/
key: "lint-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('month-number.txt', 'pyproject.toml', 'tox.ini') }}"
- name: "Create virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
.venv/bin/python -m pip install --upgrade pip setuptools wheel
.venv/bin/python -m pip install tox
- name: "Build the documentation"
run: ".venv/bin/tox run -e docs"
- name: "Check type annotations"
run: ".venv/bin/tox run -e mypy"