Merge pull request #2213 from davidculley/confine-precommit-to-stages #1935
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: Test | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Ubuntu cache | |
uses: actions/cache@v2 | |
if: startsWith(matrix.os, 'ubuntu') | |
with: | |
path: ~/.cache/pip | |
key: | |
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.python-version }}- | |
- name: macOS cache | |
uses: actions/cache@v2 | |
if: startsWith(matrix.os, 'macOS') | |
with: | |
path: ~/Library/Caches/pip | |
key: | |
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.python-version }}- | |
- name: Windows cache | |
uses: actions/cache@v2 | |
if: startsWith(matrix.os, 'windows') | |
with: | |
path: c:\users\runneradmin\appdata\local\pip\cache | |
key: | |
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.python-version }}- | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pipx install --pip-args=--constraint=.github/workflows/poetry-constraints.txt poetry | |
poetry --version | |
- name: Install dependencies | |
run: poetry install | |
- name: Test | |
shell: bash | |
run: ./scripts/test.sh | |
- name: Report Coverage | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
uses: codecov/codecov-action@v1 |