-
Notifications
You must be signed in to change notification settings - Fork 145
183 lines (166 loc) · 6.22 KB
/
ci_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
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
name: CI Tests
on:
push:
branches:
- main
pull_request:
schedule:
# run every Monday at 6am UTC
- cron: '0 6 * * 1'
env:
SETUP_XVFB: True # avoid issues if mpl tries to open a GUI window
TOXARGS: '-v'
jobs:
check_commit:
# Check the commit message for the presence of keywords that indicate
# that the CI tests should be skipped, in favor of running doc builds only.
# Messages like [docs only], [docs-only], or [skip-tests] will skip
# Only the CI part of the workflow, not the doc build.
# [skip ci], [ci skip] etc. are instead handled by GitHub itself and will skip
# the entire workflow.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
# Found this solution at
# https://monadical.com/posts/filters-github-actions.html#Case-2-Pull-request
- name: check if message indicates that tests should be skipped
id: check_commit
run: |
message=$(git log -1 --pretty=format:'%B')
re="\[(docs.only|skip-tests).*\]"
if [[ $message =~ $re ]]; then
echo "match=true" >> $GITHUB_OUTPUT
echo "$message -> Match is true"
else
echo "$message -> Match is false"
fi
outputs:
match: ${{ steps.check_commit.outputs.match }}
ci-tests:
needs: check_commit
if: ${{ needs.check_commit.outputs.match != 'true' }}
# name: ${{ matrix.os }}, ${{ matrix.tox_env }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
# A large number of test environments are defined in tox.ini. In CI,
# we select only a few, in order to conserve resources. If you add
# an additional environment, please include a comment to indicate
# why it is useful.
- name: Black test
os: ubuntu-latest
python: '3.10'
tox_env: 'black'
experimental: false
# Basic tests on the oldest & newest supported versions of Python,
# recording coverage data for the latter.
- name: Py3.8 with old Astropy version
os: ubuntu-latest
python: '3.8'
tox_env: 'py38-test-astropy4-cov'
experimental: false
- name: Linux, Py3.10 with coverage
os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test-cov'
experimental: false
# Basic tests on alternative operating systems.
- name: Windows, Py3.11 with coverage
os: windows-latest
python: '3.11'
tox_env: 'py311-test-cov'
experimental: false
- name: Mac OS M1, Py3.11
os: macos-14
python: '3.11'
tox_env: 'py311-test'
experimental: false
- name: Mac OS, Py3.11
os: macos-latest
python: '3.11'
tox_env: 'py311-test'
experimental: false
# Test with all optional dependencies installed.
- name: Linux, Py3.11 all dependencies and coverage
os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test-alldeps-cov'
use_remote_data: true
experimental: false
# Test 3.12 with basic optional dependencies installed.
- name: Linux, Py3.12 basic dependencies and coverage
os: ubuntu-latest
python: '3.12'
tox_env: 'py312-test-cov'
use_remote_data: true
experimental: true
# Development version of dependencies
- name: Linux, Py3.11 with dev versions of dependencies
os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test-devdeps-cov'
experimental: false
# Test with all optional dependencies installed.
- name: Slow tests on Linux, Py3.11, all deps and coverage
os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test-alldeps-cov'
use_remote_data: true
experimental: false
slow: true
# Test with all optional dependencies installed.
- name: Slow tests on Linux, Py3.11, basic deps and coverage
os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test-cov'
use_remote_data: true
experimental: false
slow: true
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: true
- name: Check out that no sensitive environment variable is shared
run: env
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install tox
- name: Install system dependencies
if: "endsWith(matrix.tox_env, 'build_docs')"
run: sudo apt-get -y install graphviz pandoc
- name: Print Python, pip, setuptools, and tox versions
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
python -c "import tox; print(f'tox {tox.__version__}')"
- name: Run quick tests
if: "(! matrix.use_remote_data) && (! matrix.slow)"
run: tox -e ${{ matrix.tox_env }} --
- name: Run quick tests with remote data
if: "matrix.use_remote_data && (! matrix.slow)"
run: |
pip install pytest-remotedata
tox -e ${{ matrix.tox_env }} -- --remote-data=any
- name: Run slow tests with remote data
if: "matrix.use_remote_data && matrix.slow"
run: |
pip install pytest-remotedata
tox -e ${{ matrix.tox_env }} -- --remote-data=any -m slow --run-slow
- name: Upload coverage to codecov
if: "endsWith(matrix.tox_env, '-cov')"
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml