forked from astropy/astropy
-
Notifications
You must be signed in to change notification settings - Fork 1
189 lines (174 loc) · 6.48 KB
/
ci_workflows.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
name: CI
on:
push:
branches:
- v5.0.x
pull_request:
branches:
- v5.0.x
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ARCH_ON_CI: "normal"
IS_CRON: "false"
jobs:
initial_checks:
name: Mandatory checks before CI
runs-on: ubuntu-latest
steps:
- name: Check base branch
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
const skip_label = 'skip-basebranch-check';
const { default_branch: allowed_basebranch } = context.payload.repository;
const pr = context.payload.pull_request;
if (pr.user.login === 'meeseeksmachine') {
core.info(`Base branch check is skipped since this is auto-backport by ${pr.user.login}`);
return;
}
if (pr.labels.find(lbl => lbl.name === skip_label)) {
core.info(`Base branch check is skipped due to the presence of ${skip_label} label`);
return;
}
if (pr.base.ref !== allowed_basebranch) {
core.setFailed(`PR opened against ${pr.base.ref}, not ${allowed_basebranch}`);
} else {
core.info(`PR opened correctly against ${allowed_basebranch}`);
}
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs: initial_checks
strategy:
fail-fast: true
matrix:
include:
# NOTE: this coverage test is needed for tests and code that
# run only with minimal dependencies.
- name: Python 3.9 with minimal dependencies and full coverage
os: ubuntu-latest
python: 3.9
toxenv: py39-test-cov
- name: Python 3.10 with minimal dependencies
os: ubuntu-latest
python: '3.10'
toxenv: py310-test
# NOTE: In the build below we also check that tests do not open and
# leave open any files. This has a performance impact on running the
# tests, hence why it is not enabled by default.
- name: Python 3.8 with all optional dependencies
os: ubuntu-latest
python: 3.8
toxenv: py38-test-alldeps
toxargs: -v --develop
toxposargs: --open-files
- name: Python 3.8 with oldest supported version of all dependencies
os: ubuntu-18.04
python: 3.8
toxenv: py38-test-oldestdeps
- name: Python 3.8 with numpy 1.18 and full coverage
os: ubuntu-latest
python: 3.8
toxenv: py38-test-alldeps-numpy118-cov-clocale
toxposargs: --remote-data=astropy
- name: Python 3.8 with all optional dependencies (Windows)
os: windows-latest
python: 3.8
toxenv: py38-test-alldeps
toxposargs: --durations=50
- name: Python 3.8 with all optional dependencies (MacOS X)
os: macos-latest
python: 3.8
toxenv: py38-test-alldeps
toxposargs: --durations=50
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install language-pack-fr and tzdata
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install language-pack-fr tzdata libopenblas-dev
- name: Install tox
run: python -m pip install "tox<4"
- name: Run tests
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
# TODO: Do we need --gcov-glob "*cextern*" ?
- name: Upload coverage to codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
verbose: true
allowed_failures:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs: initial_checks
strategy:
fail-fast: false
matrix:
include:
- name: (Allowed Failure) Python 3.11 with remote data and dev version of key dependencies
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-devdeps
toxposargs: --remote-data=any
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install language-pack-de and tzdata
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install language-pack-de tzdata
- name: Install Python dependencies
run: python -m pip install "tox<4"
- name: Run tests
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
parallel_and_32bit:
name: 32-bit and parallel
runs-on: ubuntu-latest
needs: initial_checks
container:
image: quay.io/pypa/manylinux2014_i686:2022-04-03-da6ecb3
steps:
# TODO: Use newer checkout actions when https://github.com/actions/checkout/issues/334 fixed
- name: Checkout code
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Write configuration items to standard location to make sure they are ignored in parallel mode
run: |
mkdir -p $HOME/.astropy/config/
printf "unicode_output = True\nmax_width = 500" > $HOME/.astropy/config/astropy.cfg
# In addition to testing 32-bit, we also use the 3.8 builds to
# test the ability to run the test suite in parallel.
# Numpy is pinned to avoid building it from source for numpy 1.21.5
- name: Install dependencies for Python 3.8
run: /opt/python/cp38-cp38/bin/pip install "tox<4"
- name: Run tests for Python 3.8
run: /opt/python/cp38-cp38/bin/python -m tox -e py38-numpy120-test -- -n=4 --durations=50
# We use the 3.8 build to check that running tests twice in a row in the
# same Python session works without issues. This catches cases where
# running the tests changes the module state permanently. Note that we
# shouldn't also test the parallel build here since that enforces a degree
# of isolation of tests which will interfere with what we are trying to do
# here.
# Numpy is pinned to avoid building it from source for numpy 1.21.5
- name: Run tests for Python 3.8
run: /opt/python/cp38-cp38/bin/python -m tox -e py38-numpy120-test-double