-
-
Notifications
You must be signed in to change notification settings - Fork 315
124 lines (122 loc) · 4.01 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
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.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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
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@v4
with:
flags: unittests
file: ./coverage.xml
fail_ci_if_error: true
env_vars: OS,PYTHON,ISORT
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}