-
Notifications
You must be signed in to change notification settings - Fork 18
255 lines (236 loc) · 9.35 KB
/
process.yml
File metadata and controls
255 lines (236 loc) · 9.35 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
name: PROCESS main/develop testing
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
env:
python-version: '3.10'
jobs:
unit-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
- name: Run unit tests with coverage report
run: |
hatch run test:tests-cov tests/unit
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: ${{ github.ref_name == 'main' }}
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run integration tests
run: hatch run test.py${{ env.python-version }}:tests-integration
example-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run example tests
run: hatch run test.py${{ env.python-version }}:tests-examples
regression-test:
runs-on: ubuntu-latest
needs: [tracking]
# depend on make and tracking job but don't skip if tracking was skipped
# run PROCESS on the regression test input files and compare results to the tracked files
if: always()
continue-on-error: true
strategy:
matrix:
tolerance: [0.2, 5]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run regression tests
run: hatch run test.py${{ env.python-version }}:tests-regression --reg-tolerance=${{ matrix.tolerance }}
run-tracking-inputs:
runs-on: ubuntu-latest
# run PROCESS on the regression test input files and archive output MFILEs
# only runs upon merge to main
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run regression input files
run: hatch run python tracking/run_tracking_inputs.py run tests/regression/input_files
- name: Move other files
run: mv tests/regression/input_files/*.json tracking/
- name: Archive tracked MFILEs
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: tracked-mfiles
path: tracking/*_MFILE.DAT
- name: Archive tracked SIG_TF.json
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: sig-tfs
path: tracking/*.json
pre-commit-quality-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run Hatch linting tasks
uses: Fusion-Power-Plant-Framework/fppf-actions/hatch-lint@c6af22fc8d00be67cca53a61177301462f499fb2
improve_quality_check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: [pre-commit-quality-check]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Get changed files
id: changes
shell: bash
run: |
set -euo pipefail
git diff --name-only origin/${{ github.base_ref }} \
| grep -E '\.pyi?$' \
> changed_files.txt || true
{
echo "files<<EOF"
cat changed_files.txt
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Run improvement lint
if: steps.changes.outputs.files != ''
shell: bash
run: |
set -euo pipefail
mapfile -t files <<< "${{ steps.changes.outputs.files }}"
hatch run lint:fmt_extra "${files[@]}"
tracking:
# update tracker to include the MFILEs created by the run-tracking-inputs job
concurrency:
group: tracking-jobs
cancel-in-progress: false
runs-on: ubuntu-latest
# depends on run-tracking-inputs; only runs upon merge to main
needs: run-tracking-inputs
if: github.ref == 'refs/heads/main'
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Setup SSH identity
uses: webfactory/ssh-agent@836c84ec59a0e7bc0eabc79988384eb567561ee2
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Download tracking data
run: git clone git@github.com:timothy-nunn/process-tracking-data.git process-tracking-data
- name: Download MFILEs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: tracked-mfiles
path: tracking/
- name: Create new tracking entries
shell: bash
run: |
MSG=$(printf "%q " $COMMIT_MESSAGE)
git config --global --add safe.directory '*'
hatch run python tracking/run_tracking_inputs.py track process-tracking-data "${MSG}" ${{ github.sha }}
- name: Create the tracking dashboard
run: hatch run python tracking/tracking_data.py plot process-tracking-data --out tracking.html
- name: Archive tracking dashboard
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: tracking-html
path: tracking.html
- name: Setup Git identity
run: |
git config --global user.email "${{ github.triggering_actor }}@github.runner"
git config --global user.name "${{ github.job }}"
- name: Commit and push tracking data
run: |
cd process-tracking-data
git add .
git commit -m "${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
git push
docs:
concurrency:
group: docs-jobs
cancel-in-progress: false
runs-on: ubuntu-latest
# depends on tracking; only runs upon merge to main
needs: tracking
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- run: git config --global --add safe.directory '*'
- name: Download STF_TF.json files
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: sig-tfs
path: tracking/
- name: Download MFILEs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: tracked-mfiles
path: tracking/
- run: mv tracking/large_tokamak_nof.SIG_TF.json tracking/large_tokamak_nof_SIG_TF.json
- name: Create an example plot summary
run: hatch run process plot summary -f tracking/large_tokamak_nof_MFILE.DAT
- name: Move plot summary file to docs images
run: mv tracking/large_tokamak_nof_MFILE.DATSUMMARY.pdf documentation/source/images/plot_summary.pdf
- run: hatch run docs:build
- name: Download tracking html
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: tracking-html
- run: mv tracking.html site || cp site/404.html site/tracking.html
- name: Upload documentation page
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
with:
path: site/
- name: Deploy GitHub pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e