Merge pull request #405 from kurtmckee/batch-dependabot-updates #290
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@8ade135a41bc03ea155e62e844d188df1ea18608" # v4.1.0 | |
- name: "Setup Python" | |
id: "setup-python" | |
uses: "actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1 | |
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@704facf57e6136b1bc63b828d79edcd491f0ee84" # v3.3.2 | |
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@8ade135a41bc03ea155e62e844d188df1ea18608" # v4.1.0 | |
- name: "Setup Python" | |
id: "setup-python" | |
uses: "actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1 | |
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@704facf57e6136b1bc63b828d79edcd491f0ee84" # v3.3.2 | |
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" |