forked from sherpa/sherpa
-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (196 loc) · 6.59 KB
/
ci-conda-workflow.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
name: Conda CI
on:
push:
branches:
- main
- numpy-1.26
tags:
- '*'
pull_request:
env:
xspec_channel: "xspec/label/test"
CONDA_BUILD_SYSROOT: ${{ github.workspace }}/10.14SDK/MacOSX10.14.sdk
jobs:
tests:
defaults:
run:
shell: bash
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: MacOS Full Build
os: macos-latest
python-version: "3.10"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.13.1
# run xvfb with this display
display: :99
- name: Linux Minimum Setup (Python 3.9)
os: ubuntu-latest
python-version: "3.9"
numpy-version: "1.21"
install-type: develop
test-data: none
- name: Linux Minimum Setup (Python 3.11)
os: ubuntu-latest
python-version: "3.11"
numpy-version: "1.23"
install-type: develop
test-data: none
- name: Linux Full Build (Python 3.11)
os: ubuntu-latest
python-version: "3.11"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.13.1
- name: Linux Full Build (Python 3.10)
os: ubuntu-latest
python-version: "3.10"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.13.0c
- name: Linux Full Build (Python 3.9)
os: ubuntu-latest
python-version: "3.9"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.12.0g
- name: Linux Build (w/o Astropy or Xspec)
os: ubuntu-latest
python-version: "3.11"
install-type: install
test-data: package
matplotlib-version: 3
- name: Linux Build (w/o Matplotlib, Xspec, or test data)
os: ubuntu-latest
python-version: "3.9"
numpy-version: "1.21"
install-type: develop
fits: astropy
test-data: none
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
submodules: 'True'
# https://stackoverflow.com/questions/63648591/how-to-install-x11-before-testing-with-github-actions-for-macos
- name: Install XQuartz on macOS
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
- name: Conda Setup
env:
PYTHONVER: ${{ matrix.python-version }}
NUMPYVER: ${{ matrix.numpy-version }}
FITSBUILD: ${{ matrix.fits }}
MATPLOTLIBVER: ${{ matrix.matplotlib-version }}
XSPECVER: ${{ matrix.xspec-version }}
run: |
source .github/scripts/setup_conda.sh
- name: Conda Setup (Xspec and DS9)
if: matrix.xspec-version != ''
env:
XSPECVER: ${{ matrix.xspec-version }}
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
source .github/scripts/setup_ds9.sh
source .github/scripts/setup_xspec.sh
- name: Start Xvfb (macOS)
if: runner.os == 'macOS'
env:
DISPLAY: ${{ matrix.display }}
run: |
sudo /opt/X11/bin/Xvfb ${DISPLAY} -ac -screen 0 1024x768x8 &
- name: Build Sherpa (install)
if: matrix.install-type == 'install'
env:
PYTHON_LDFLAGS: " "
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
pip install . --verbose
- name: Build Sherpa (develop)
if: matrix.install-type == 'develop'
env:
PYTHON_LDFLAGS: " "
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
pip install -e . --verbose
- name: Install the test data?
if: matrix.test-data == 'package'
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
pip install ./sherpa-test-data
pip install pytest-xvfb
- name: Remove submodule
if: matrix.test-data == 'none' || matrix.test-data == 'package'
run: |
git submodule deinit -f .
# run the smoke test first as it's small/quick to do
- name: Smoke Tests
env:
XSPECVER: ${{ matrix.xspec-version }}
FITS: ${{ matrix.fits }}
run: |
if [ -n "${XSPECVER}" ]; then XSPECTEST="-x -d"; fi
if [ -n "${FITS}" ] ; then FITSTEST="-f ${FITS}"; fi
smokevars="${XSPECTEST} ${FITSTEST} -v 3"
echo "** smoke test: ${smokevars}"
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
cd /home
sherpa_smoke ${smokevars}
- name: Internal check
if: matrix.test-data == 'submodule' && matrix.install-type != 'develop'
env:
INSTALLTYPE: ${{ matrix.install-type }}
run: |
# At the moment "Submodule Tests" requires the develop
# install-type, otherwise the "python setup.py test" call will
# lead to the develop build to be re-run, meaning that the
# install option is not tested. When we change to pytest we
# can switch to something like 'cd $HOME; pytest sherpa'
#
echo "ERROR: submodule test can not be run with install-type=${INSTALLTYPE}"
exit 1
- name: Submodule Tests
if: matrix.test-data == 'submodule'
env:
INSTALLTYPE: ${{ matrix.install-type }}
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
# make sure pytext-xvfb can find Xvfb
export PATH="${PATH}:/opt/X11/bin"
fi
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
conda install -yq pytest-cov
python setup.py -q test -a "--cov sherpa --cov-report xml"
- name: sherpa_test Tests
if: matrix.test-data == 'package' || matrix.test-data == 'none'
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
conda install -yq pytest-cov
cd $HOME
sherpa_test --cov sherpa --cov-report xml
- name: upload coverage
uses: codecov/codecov-action@v3
with:
# only select the reports that we know are coverage reports, from linux conda, mac conda, and pip
files: /home/runner/work/sherpa/sherpa/coverage.xml,/Users/runner/work/sherpa/sherpa/coverage.xml,/home/runner/coverage.xml
verbose: true