-
Notifications
You must be signed in to change notification settings - Fork 8
193 lines (179 loc) · 5.22 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
name: Tests
on:
schedule:
# run every Sunday at 10:13 am UTC (3:13 am PT)
- cron: '13 10 * * 0'
push:
branches:
- master
tags:
- "v*"
pull_request:
workflow_dispatch:
jobs:
base-tests:
name: py${{ matrix.python }} ${{ matrix.name-modifier }} - on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# mark default
- python: '3.9'
os: ubuntu-latest
do-coverage: false
name-modifier: ''
# mark case for coverage reporting
- python: '3.10'
os: ubuntu-latest
do-coverage: true
name-modifier: 'with Coverage'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install 'bapsflib' dependencies
run: |
python -m pip install pip --upgrade
python -m pip install -r requirements/tests.txt --upgrade
- name: Run tests ${{ matrix.name-modifier }}
run: |
if ${{ matrix.do-coverage }}; then
coverage run -m unittest discover
else
python -m unittest discover
fi
shell: bash
- name: Report coverage
if: ${{ matrix.do-coverage && !failure() }}
uses: codecov/codecov-action@v4
with:
files: .coverage
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
tests:
needs: base-tests
name: py${{ matrix.python }} - on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
# these were done in base-tests
- python: '3.10'
os: ubuntu-latest
- python: '3.9'
os: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install 'bapsflib' dependencies
run: |
python -m pip install pip --upgrade
python -m pip install -r requirements/tests.txt --upgrade
- name: Run tests
run: |
python -m unittest discover
shell: bash
test-mins:
# test min versions of key dependencies
needs: tests
name: Min Vers | py-${{ matrix.python }} | ${{ matrix.spec-name }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- spec-name: h5py v3.0
min-install: h5py==3.0
python: '3.9'
- spec-name: h5py v3.0 numpy v1.20
min-install: h5py==3.0 numpy==1.20
python: '3.9'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install 'bapsflib' dependencies
run: |
python -m pip install pip --upgrade
python -m pip install -r requirements/tests.txt ${{ matrix.min-install }}
- name: Run tests
run: python -m unittest discover
import-bapsflib:
name: Importing bapsflib
needs: base-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install 'bapsflib' dependencies
run: |
python -m pip install pip --upgrade
python -m pip install -r requirements/install.txt
- name: Import 'bapsflib'
run: |
python -c 'import bapsflib'
build-bapsflib:
name: Packaging
runs-on: ubuntu-latest
needs:
- test-mins
- import-bapsflib
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requirements
run: |
pip install --progress-bar off --upgrade pip
pip install --progress-bar off -r requirements/install.txt
pip install --progress-bar off twine importlib_metadata!=8.0.0
- name: Build a binary wheel
run: |
python setup.py bdist_wheel
- name: Build a source tarball
run: |
python setup.py sdist
- name: Twine check
run: |
twine check dist/*
- name: Install bapsflib in all variants
run: |
pip install --progress-bar off .[developer]
pip install --progress-bar off -e .[developer]
python setup.py develop