forked from spacetelescope/jdaviz
-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (184 loc) · 6.89 KB
/
Copy pathci_workflows.yml
File metadata and controls
206 lines (184 loc) · 6.89 KB
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
name: CI
on:
push:
branches:
- main
- 'v*'
tags:
- 'v*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Github Actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
ci_tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow_failure || contains(github.event.pull_request.labels.*.name, 'continue-on-error') }}
strategy:
matrix:
include:
- name: Code style checks
os: ubuntu-latest
python: 3.x
toxenv: codestyle
allow_failure: false
- name: PEP 517
os: ubuntu-latest
python: 3.x
toxenv: pep517
allow_failure: false
- name: Security audit
os: ubuntu-latest
python: 3.x
toxenv: securityaudit
allow_failure: false
- name: Python 3.13 with coverage checking and all deps
os: ubuntu-latest
python: '3.13'
toxenv: py313-test-alldeps-cov
toxposargs: --run-slow
allow_failure: false
- name: Python 3.13 with only remote data, coverage checking, and all deps
os: ubuntu-latest
python: '3.13'
toxenv: py313-test-alldeps-cov
toxposargs: --remote-data --run-slow -m remote_data
allow_failure: true
- name: OS X - Python 3.13
os: macos-latest
python: '3.13'
toxenv: py313-test
allow_failure: false
- name: Windows - Python 3.13
os: windows-latest
python: '3.13'
toxenv: py313-test
allow_failure: false
- name: Linux - Python 3.14
os: ubuntu-latest
python: '3.14'
toxenv: py314-test
allow_failure: false
# This also runs on cron but we want to make sure new changes
# won't break this job at the PR stage.
- name: Python 3.13 with latest dev versions of key dependencies
os: ubuntu-latest
python: '3.13'
toxenv: py313-test-devdeps
toxposargs: --run-slow
allow_failure: true
- name: Python 3.13 with only remote data and dev deps
os: ubuntu-latest
python: '3.13'
toxenv: py313-test-devdeps
toxposargs: --remote-data --run-slow -m remote_data
allow_failure: true
- name: Python 3.12 with stable versions of dependencies and Roman
os: ubuntu-latest
python: '3.12'
toxenv: py312-test-romandeps
allow_failure: true
steps:
- name: Build toxposargs from labels
id: build-toxposargs
shell: bash
env:
LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
run: |
toxposargs="${{ matrix.toxposargs }}"
# Add --skip-remote-failures if 'skip-remote-failures' label is present
if echo "$LABELS" | grep -q 'skip-remote-failures'; then
toxposargs="$toxposargs --skip-remote-failures"
fi
# Export as step output so later steps can reference it.
echo "toxposargs=$toxposargs" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python }} on ${{ matrix.os }}
uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a # v5.6.0
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: python -m pip install --upgrade pip tox
- name: Install extra dependencies for strauss
if: "contains(matrix.toxenv, 'alldeps')"
run: sudo apt-get install libportaudio2
- name: Get IP address for MAST debugging
if: "contains(matrix.toxposargs, '--remote-data')"
run: curl https://api.ipify.org
- name: Get components for cache key
id: date
if: "contains(matrix.toxposargs, '--remote-data')"
shell: bash
run: |
echo "year=$(date +'%Y')" >> $GITHUB_OUTPUT
echo "week=$(date +'%V')" >> $GITHUB_OUTPUT
echo "day=$(date +'%j')" >> $GITHUB_OUTPUT
- name: Restore MAST cache
if: "contains(matrix.toxposargs, '--remote-data')"
id: cache-restore
uses: actions/cache/restore@v6
with:
path: ./
key: use-restore-keys-below-to-match-in-priority-order
restore-keys: |
mast-cache-${{ steps.date.outputs.year }}-${{ steps.date.outputs.week }}-${{ steps.date.outputs.day }}-
mast-cache-${{ steps.date.outputs.year }}-${{ steps.date.outputs.week }}-
mast-cache-${{ steps.date.outputs.year }}-
mast-cache-
- name: Move cache to tox working directory
if: "contains(matrix.toxposargs, '--remote-data')"
shell: bash
run: |
# Create cache directories for all possible tox environments
# tox runs from .tmp/{envname}, so we need to place cache files there
mkdir -p ".tmp/${{ matrix.toxenv }}"
# Check if any fits files exist and move them to the tox working directory
if ls ./*.fits 1> /dev/null 2>&1; then
mv ./*.fits ".tmp/${{ matrix.toxenv }}/"
echo "Cache files moved to .tmp/${{ matrix.toxenv }}/"
echo "Files in tox working directory:"
ls -la ".tmp/${{ matrix.toxenv }}/"*.fits
else
echo "No .fits files found in cache - tests will download files as needed"
fi
- name: Test/run with tox
run: tox -e ${{ matrix.toxenv }} -- ${{ steps.build-toxposargs.outputs.toxposargs }}
- name: Upload coverage to artifacts
if: "contains(matrix.toxenv, '-cov')"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage_${{ matrix.toxenv }}.xml
path: coverage.xml
if-no-files-found: error
upload-codecov:
needs: [ ci_tests ]
permissions:
contents: none
runs-on: ubuntu-latest
name: Upload Coverage
steps:
# work around CodeCov upload issue
# see: https://github.com/codecov/codecov-action/issues/1801
- uses: actions/checkout@v7
- name: Download coverage artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: coverage
pattern: coverage_*
merge-multiple: true
- name: Upload report to Codecov
if: ${{ hashFiles('coverage/') != '' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
fail_ci_if_error: true
verbose: true