[pre-commit.ci] pre-commit autoupdate #2412
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: | |
pull_request: {} | |
jobs: | |
test: | |
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }} and isort ${{ matrix.isort-version }} and pydantic ${{ matrix.pydantic-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
isort-version: [4.3.21, 5.6.4] | |
black-version: [22.1.0, default] | |
pydantic-version: [1.5.1, 1.10.9, 2.4.2] | |
include: | |
- os: ubuntu-latest | |
isort-version: 5.6.4 | |
black-version: default | |
python-version: 3.8 | |
pydantic-version: 1.8.2 | |
- os: ubuntu-latest | |
isort-version: 5.6.4 | |
black-version: 19.10b0 | |
python-version: 3.9 | |
pydantic-version: 1.8.2 | |
- os: ubuntu-latest | |
isort-version: 5.6.4 | |
black-version: 24.1.0 | |
python-version: 3.12 | |
pydantic-version: 2.4.2 | |
- os: ubuntu-latest | |
isort-version: 5.6.4 | |
black-version: 23.12.1 | |
python-version: 3.12 | |
pydantic-version: 2.4.2 | |
exclude: | |
- os: windows-latest | |
black-version: 22.1.0 | |
- os: macos-latest | |
black-version: 22.1.0 | |
- os: windows-latest | |
isort-version: 4.3.21 | |
- os: macos-latest | |
isort-version: 4.3.21 | |
- os: windows-latest | |
pydantic-version: 1.5.1 | |
- os: macos-latest | |
pydantic-version: 1.5.1 | |
- python-version: 3.9 | |
pydantic-version: 1.5.1 | |
- python-version: 3.10 | |
pydantic-version: 1.5.1 | |
- python-version: 3.11 | |
pydantic-version: 1.5.1 | |
- python-version: 3.12 | |
pydantic-version: 1.5.1 | |
defaults: | |
run: | |
shell: bash | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
ISORT: ${{ matrix.isort-version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install old Poetry | |
uses: snok/install-poetry@v1 | |
if: matrix.python-version == '3.7' | |
with: | |
version: 1.4.2 | |
virtualenvs-path: .venv | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
if: matrix.python-version != '3.7' | |
with: | |
version: 1.7.1 | |
virtualenvs-path: .venv | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
if: matrix.os != 'windows-latest' | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pydantic-version }}-v1-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction -E http -E graphql | |
- name: Install isort ${{ matrix.isort-version }} for Linux/macOS | |
if: runner.os != 'Windows' | |
run: | | |
poetry run pip install isort=="$ISORT" | |
- name: Install Pydantic ${{ matrix.pydantic-version }} | |
if: matrix.pydantic-version != 'default' | |
run: | | |
poetry run pip install pydantic=="${{ matrix.pydantic-version }}" | |
- name: Install Black ${{ matrix.black-version }} | |
if: matrix.black-version != 'default' | |
run: | | |
poetry run pip install black=="${{ matrix.black-version }}" | |
- name: Lint | |
if: matrix.pydantic-version == 'default' | |
run: | | |
source $VENV | |
./scripts/lint.sh | |
- name: Unit Test | |
run: | | |
source $VENV | |
./scripts/test.sh | |
- name: Upload coverage to Codecov | |
if: matrix.os == 'ubuntu-latest' && matrix.pydantic-version != '1.5.1' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
env_vars: OS,PYTHON,ISORT |