-
Notifications
You must be signed in to change notification settings - Fork 1
257 lines (198 loc) · 7.46 KB
/
tests.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
250
251
252
253
254
255
256
257
name: Tests
on: [push, pull_request]
jobs:
test-current-poetry:
name: 3.11 poetry
strategy:
matrix:
runner: [pytest, unittest, doctest]
os-abbreviation: [lin, mac, win]
include:
- runner: pytest
description: Run all tests (pytest)
command: pytest --doctest-modules
# Including this both here and below in test-compatible-poetry runs
# the unittest runner both with frozen poetry.lock package versions
# (here) and non-frozen package versions (tests-compatible-poetry).
#
# This differs from conda, where we're not freezing package versions.
# So the unittest runner is listed in test-compatible-conda but not
# also test-current-conda. If it were in both conda job definitions,
# it would test exactly the same configuration and behavior twice.
#
- runner: unittest
description: Run unittest tests
command: python -m unittest
- runner: doctest
description: Run doctests
command: python -m doctest palgoviz/*.py tests/*.py tests/*.txt
- poetry: ~/.local/bin/poetry
- os-abbreviation: lin # GNU/Linux (Ubuntu)
os: ubuntu-latest
- os-abbreviation: mac # macOS
os: macos-latest
- os-abbreviation: win # Windows
os: windows-latest
poetry: |-
"$APPDATA/Python/Scripts/poetry"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# TODO: Print the install script commit hash and Poetry version.
- name: Install poetry
run: |
curl -sSL https://raw.githubusercontent.com/EliahKagan/install.python-poetry.org/ci-repro/palgoviz/install-poetry.py |
python3 -
- name: Install project and test runner
run: ${{ matrix.poetry }} install --only=main,test
- name: ${{ matrix.description }}
run: ${{ matrix.poetry }} run ${{ matrix.command }}
timeout-minutes: 2
test-current-conda:
name: 3.11 conda
strategy:
matrix:
runner: [pytest, doctest]
os-abbreviation: [lin, mac, win]
include:
- runner: pytest
description: Run all tests (pytest)
command: pytest --doctest-modules
# NOTE: The unittest runner is not listed here, because it is listed
# in test-compatible-conda below. Unlike test-current-poetry and
# test-compatible-poetry, where the former uses uses frozen
# poetry.lock package versions and latter doesn't, neither this nor
# the other conda job definition (test-compatible-conda) use frozen
# package versions. So having it in both of these would always test
# exactly the same configuration and behavior.
- runner: doctest
description: Run doctests
command: python -m doctest palgoviz/*.py tests/*.py tests/*.txt
- os-abbreviation: lin # GNU/Linux (Ubuntu)
os: ubuntu-latest
- os-abbreviation: mac # macOS
os: macos-latest
- os-abbreviation: win # Windows
os: windows-latest
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
- name: Make editable install
run: pip install -e .
- name: ${{ matrix.description }}
run: ${{ matrix.command }}
timeout-minutes: 2
test-compatible-poetry:
name: 3.10+ poetry
strategy:
matrix:
runner: [pytest, unittest]
os-abbreviation: [lin, mac, win]
python-version: ['3.10', '3.11']
include:
- runner: pytest
description: Run some tests (pytest)
command: pytest --ignore=tests/test_{greet,greetall}.txt
- runner: unittest
description: Run unittest tests
command: python -m unittest
- poetry: ~/.local/bin/poetry
- os-abbreviation: lin # GNU/Linux (Ubuntu)
os: ubuntu-latest
- os-abbreviation: mac # macOS
os: macos-latest
- os-abbreviation: win # Windows
os: windows-latest
poetry: |-
"$APPDATA/Python/Scripts/poetry"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Remove poetry.lock
run: rm poetry.lock
- name: Substitute Python version
run: |
perl -i -spwe 's/^python = "~\K[^"]+(?="$)/$pyver/' -- \
-pyver=${{ matrix.python-version }} pyproject.toml
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# TODO: Print the install script commit hash and Poetry version.
- name: Install poetry
run: |
curl -sSL https://raw.githubusercontent.com/EliahKagan/install.python-poetry.org/ci-repro/palgoviz/install-poetry.py |
python3 -
- name: Install project and test runner
run: ${{ matrix.poetry }} install --only=main,test
- name: ${{ matrix.description }}
run: ${{ matrix.poetry }} run ${{ matrix.command }}
timeout-minutes: 2
test-compatible-conda:
name: 3.10+ conda
strategy:
fail-fast: false
matrix:
runner: [pytest, unittest]
os-abbreviation: [lin, mac, win]
python-version: ['3.10', '3.11']
include:
- runner: pytest
description: Run some tests (pytest)
command: pytest --ignore=tests/test_{greet,greetall}.txt
- runner: unittest
description: Run unittest tests
command: python -m unittest
- os-abbreviation: lin # GNU/Linux (Ubuntu)
os: ubuntu-latest
- os-abbreviation: mac # macOS
os: macos-latest
- os-abbreviation: win # Windows
os: windows-latest
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Substitute Python version in environment.yml
run: |
perl -i -spwe 's/^ *- python=\K.+$/$pyver/' -- \
-pyver=${{ matrix.python-version }} environment.yml
# If we switch back from "pip install -e ." to "conda develop ." then
# this step can and should be removed from this job definition (though it
# may of course still be needed in jobs that use poetry instead of conda).
- name: Substitute python version in pyproject.toml
run: |
perl -i -spwe 's/^python = "~\K[^"]+(?="$)/$pyver/' -- \
-pyver=${{ matrix.python-version }} pyproject.toml
- name: Set up micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
- name: Make editable install
run: pip install -e .
- name: ${{ matrix.description }}
run: ${{ matrix.command }}
timeout-minutes: 2