-
Notifications
You must be signed in to change notification settings - Fork 19
148 lines (123 loc) · 4.17 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Test
on:
pull_request:
branches:
- main
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Test our minimum version bound, the highest version available,
# and something in the middle (i.e. what gets run locally).
python-version: ["3.7", "3.9", "3.12"]
pytest-asyncio-version: ["0.16.0", "0.19.0"]
sqlalchemy-version: ["1.3.0", "1.4.0", "2.0.0"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.2.2
- name: Set up cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install base dependencies
run: poetry run make install-base
- name: Install specific sqlalchemy version
run: |
poetry run pip install 'sqlalchemy~=${{ matrix.sqlalchemy-version }}'
- name: Install specific pytest-asyncio version
run: pip install 'pytest-asyncio~=${{ matrix.pytest-asyncio-version }}'
- if: ${{ matrix.python-version == '3.9' && matrix.sqlalchemy-version == '2.0.0' }}
run: poetry run make lint
- run: poetry run make test-base
- name: Install dependencies
run: poetry run make install
- run: poetry run make test
- name: Store test result artifacts
uses: actions/upload-artifact@v3
with:
path: coverage.xml
- name: Coveralls
env:
COVERALLS_FLAG_NAME: run-${{ inputs.working-directory }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
run: |
pip install tomli coveralls
coveralls --service=github
# Tests that postgres async fixture functions without psycopg2 installed.
test-asyncpg:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Test our minimum version bound, the highest version available,
# and something in the middle (i.e. what gets run locally).
python-version: ["3.9"]
sqlalchemy-version: ["1.4.0"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.2.2
- name: Set up cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install base dependencies
run: poetry run poetry install -E postgres-async
- name: Install specific sqlalchemy version
run: |
poetry run pip install 'sqlalchemy~=${{ matrix.sqlalchemy-version }}'
- run: SQLALCHEMY_WARN_20=1 poetry run coverage run -a -m pytest src tests -vv -m 'asyncio'
- name: Store test result artifacts
uses: actions/upload-artifact@v3
with:
path: coverage.xml
- name: Coveralls
env:
COVERALLS_FLAG_NAME: run-${{ inputs.working-directory }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
run: |
pip install tomli coveralls
coveralls --service=github
finish:
needs:
- test
- test-asyncpg
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install tomli coveralls
coveralls --service=github --finish