-
Notifications
You must be signed in to change notification settings - Fork 1
249 lines (202 loc) · 6.37 KB
/
ci.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: ci
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install python dependencies
run: |
pip install .[dev]
pip freeze
- name: Run pre-commit
run:
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
ubuntu-apt:
# ubuntu using postgresql installed via apt (+ pgtest)
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.11]
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: sudo apt update && sudo apt install postgresql && sudo service postgresql restart
- name: Install pgsu
run: |
pip install -e .[dev]
pip freeze
- name: Run test suite
run: pytest --cov-report xml -sv
- name: Upload coverage report
if: github.repository == 'aiidateam/pgsu'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: ubuntu-apt
file: ./coverage.xml
fail_ci_if_error: true
ubuntu-postgres-action:
# ubuntu using postgres docker container (custom action)
runs-on: ubuntu-22.04
timeout-minutes: 5
strategy:
matrix:
python-version: [3.9]
postgres-pw: ["testpw"]
steps:
- uses: actions/checkout@v3
- uses: CasperWA/postgresql-action@v1.2
with:
postgresql version: '10'
postgresql db: test_db
postgresql user: postgres
postgresql password: ${{ matrix.postgres-pw}}
#postgresql auth: trust
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install pgsu
run: |
pip install -e .[dev]
pip freeze
- name: Run test suite
env:
PGSU_TEST_PASSWORD: ${{ matrix.postgres-pw}}
run: pytest --cov-report xml -sv
- name: Upload coverage report
if: github.repository == 'aiidateam/pgsu'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: ubuntu-apt
file: ./coverage.xml
fail_ci_if_error: true
ubuntu-postgres-service:
# ubuntu using postgres docker container (service provided by github actions)
runs-on: ubuntu-22.04
timeout-minutes: 5
strategy:
matrix:
python-version: [3.9]
postgres-pw: ["testpw"]
services:
postgres:
image: postgres:10.8
env:
POSTRGRES_USER: postgres
POSTGRES_PASSWORD: ${{ matrix.postgres-pw}}
POSTGRES_DB: test_db
ports:
# will assign a random free host port
- 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install pgsu
run: |
pip install -e .[dev]
pip freeze
- name: Run test suite
env:
PGSU_TEST_PASSWORD: ${{ matrix.postgres-pw}}
PGSU_TEST_PORT: ${{ job.services.postgres.ports[5432] }}
run: pytest --cov-report xml -sv
- name: Upload coverage report
if: github.repository == 'aiidateam/pgsu'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: ubuntu-postgres-service
file: ./coverage.xml
fail_ci_if_error: true
# macos-brew:
# # macos using postgres installed via homebrew (+pgtest)
#
# runs-on: macos-12
# timeout-minutes: 5
#
# strategy:
# matrix:
# python-version: [3.8]
#
# steps:
# - uses: actions/checkout@v3
#
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
#
# - name: Install system dependencies
# run: |
# brew install postgresql || brew link --overwrite postgresql
#
# - name: Install pgsu
# run: |
# pip install -e .[dev]
# pip freeze
#
# # note: I tested this locally with *only* the homebrew postgres server running and it worked.
# # no idea why this does not work on github actions
# # Edit: It seems homebrew postgresql does not create the postgres user automatically.
# - name: Run test suite
# run: |
# brew services start postgresql
# brew services list
# pytest
multi-conda:
# windows and macos with postgres installed via conda (+pgtest)
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
python-version: [3.8]
os: ['macos-12', 'windows-2022']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
run-post: false # https://github.com/conda-incubator/setup-miniconda/issues/280
- name: Install system dependencies
shell: bash -l {0}
run: |
conda install -y -c anaconda postgresql
initdb -D test_db
pg_ctl -D test_db -o "-d 5" start # start with debugging
- name: Install pgsu
run: |
pip install -e .[dev]
pip freeze
- name: Run test suite
run: pytest --cov-report xml -sv
- name: Upload coverage report
if: github.repository == 'aiidateam/pgsu'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: "${{ matrix.os }}-conda"
file: ./coverage.xml
fail_ci_if_error: true