-
Notifications
You must be signed in to change notification settings - Fork 8
342 lines (330 loc) · 11.6 KB
/
build-pr.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
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
name: Build Branch
run-name: Build «${{ github.ref_name }}» (${{ github.actor}})
on:
push:
branches-ignore:
- main
- release/*
tags-ignore:
- '*'
workflow_call:
inputs:
is_called_workflow:
required: true
default: false
type: boolean
description: |
Should be set to true. This is used to determine of this workflow was called directly or
from another workflow.
do_instrumentation:
required: false
default: false
type: boolean
description: |
Set to true to enable instrumentation of Igor code. The execution will be approx. 30%
slower.
secrets:
GHA_MIES_CERTIFICATE_PIN:
required: true
GHA_MIES_FTP_ARTEFACT_STORAGE_USER:
required: true
GHA_MIES_FTP_ARTEFACT_STORAGE_PWD:
required: true
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Ipt:
name: 🔎 IPT Format check
runs-on: [ self-hosted, Windows ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# no need to checkout submodules or the full history
- name: Download ipt binary from server
run: curl -o ipt.exe "https://byte-physics.de/public-downloads/aistorage/transfer/ipt/0.6.0/ipt.exe"
- name: IPT version
run: ./ipt.exe --version
- name: Format code
run: tools/ipt-format.sh
- name: Check for changed files
run: git diff --name-only --ignore-submodules; git diff --ignore-submodules --quiet
- name: Create patch
if: ${{ failure() }}
run: git diff > format-changes.patch
- name: upload artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: IPT-assets
path: |
format-changes.patch
if-no-files-found: warn
BuildInstaller:
name: 🏗 Build ${{ matrix.kind }} installer
strategy:
matrix:
kind:
# the normal installer
- user
# This installer is *only* intended for developer internal use!
- dev
runs-on: [ self-hosted, Windows, Certificate ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # load all commits
- name: Initial repo config
run: tools/initial-repo-config.sh
- name: Create release package and installer
run: tools/create-installer.sh ${{ fromJSON('["", "dev"]')[ matrix.kind == 'dev' ] }}
- name: Sign installer
run: tools/sign-installer.sh -p '${{ secrets.GHA_MIES_CERTIFICATE_PIN }}'
- name: upload artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: BuildInstaller-${{ matrix.kind }}-assets
path: |
*.zip
tools/installer/MIES-*.exe
if-no-files-found: error
Linting:
name: 🔎 Linting
runs-on: [ self-hosted, Linux, Docker ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Code Checks
run: tools/check-code.sh
# straight from the documentation, see https://pre-commit.com/#github-actions-example
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Pre commit
run: tools/pre-commit/run.sh
CompilationTest:
name: |
👩🏾🔬 Compilation: ${{ matrix.source }} ${{ fromJSON('["","with XOP"]')[matrix.hardware] }}
needs:
- BuildInstaller
strategy:
matrix:
source: [ git, installer ]
hardware: [ false, true ]
exclude:
# the git source is always checked with hardware support
- source: git
hardware: false
uses: ./.github/workflows/test-igor-workflow.yml
with:
job_name: |
👩🏾🔬 Compilation: ${{ matrix.source }} ${{ fromJSON('["","with XOP"]')[matrix.hardware] }}
overwrite_job_name: ${{ inputs.is_called_workflow || false }}
experiment: Packages/tests/Compilation/CompilationTester.pxp
installer_artifact_name: BuildInstaller-dev-assets
installer_flags: ${{ fromJSON('["-x skipHardwareXOPs",""]')[matrix.hardware] }} -s ${{ matrix.source }}
artifact_name: CompilationTest-${{ matrix.source }}-${{ fromJSON('["no-hardware","hardware"]')[matrix.hardware] }}-assets
timeout_minutes: 60
CompilationEachCommitTest:
name: |
👩🏾🔬 Compilation: Each commit
if: ${{ !inputs.is_called_workflow }}
uses: ./.github/workflows/test-igor-rebase-exec-workflow.yml
with:
job_name: |
👩🏾🔬 Compilation: Each commit
overwrite_job_name: ${{ inputs.is_called_workflow || false }}
experiment: Packages/tests/Compilation/CompilationTester.pxp
installer_flags: "-s git"
artifact_name: Compilation-Each-Commit-assets
timeout_minutes: 180
Documentation:
name: 👷 Documentation
runs-on: [ self-hosted, Linux, Docker ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # load all commits
- name: Initial repo config
run: tools/initial-repo-config.sh
- name: Build documentation
run: tools/documentation/run.sh
- name: upload artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: Documentation-assets
path: |
Packages/doc/*.zip
if-no-files-found: error
TestWithoutHardware:
name: 🧪 Test ${{ matrix.name }}
needs:
- BuildInstaller
- Linting
- CompilationTest
strategy:
matrix:
include:
- experiment: Packages/tests/Basic/Basic.pxp
name: Basic
- experiment: Packages/tests/PAPlot/PAPlot.pxp
name: PAPlot
- experiment: Packages/tests/HistoricData/HistoricData.pxp
name: HistoricData
uses: ./.github/workflows/test-igor-workflow.yml
with:
job_name: 🧪 Test ${{ matrix.name }}
overwrite_job_name: ${{ inputs.is_called_workflow || false }}
experiment: ${{ matrix.experiment }}
artifact_name: TestWithoutHardware-${{ matrix.name }}-assets
expensive_checks: "1"
instrument_tests: ${{ fromJson('["0", "1"]')[inputs.do_instrumentation] }}
timeout_minutes: 60
TestNI:
name: 🧪 Test NI ${{ matrix.name }}
needs:
- BuildInstaller
- CompilationTest
- TestWithoutHardware
strategy:
matrix:
include:
- experiment: Packages/tests/HardwareBasic/HardwareBasic-NI.pxp
name: HardwareBasic
- experiment: Packages/tests/HardwareAnalysisFunctions/HardwareAnalysisFunctions-NI.pxp
name: HardwareAnalysisFunctions
uses: ./.github/workflows/test-igor-workflow.yml
with:
job_name: 🧪 Test NI ${{ matrix.name }}
overwrite_job_name: ${{ inputs.is_called_workflow || false }}
experiment: ${{ matrix.experiment }}
target: "[ 'self-hosted', 'Windows', 'IgorPro', 'NI' ]"
artifact_name: TestNI-${{ matrix.name }}-assets
expensive_checks: "1"
instrument_tests: ${{ fromJson('["0", "1"]')[inputs.do_instrumentation] }}
timeout_minutes: 180
TestITC18:
name: 🧪 Test ITC18-USB ${{ matrix.name }}
needs:
- BuildInstaller
- CompilationTest
- TestWithoutHardware
strategy:
matrix:
include:
- experiment: Packages/tests/HardwareBasic/HardwareBasic.pxp
name: HardwareBasic
- experiment: Packages/tests/HardwareAnalysisFunctions/HardwareAnalysisFunctions.pxp
name: HardwareAnalysisFunctions
uses: ./.github/workflows/test-igor-workflow.yml
with:
job_name: 🧪 Test ITC18-USB ${{ matrix.name }}
overwrite_job_name: ${{ inputs.is_called_workflow || false }}
experiment: ${{ matrix.experiment }}
target: "[ 'self-hosted', 'Windows', 'IgorPro', 'ITC' ]"
artifact_name: TestITC18-${{ matrix.name }}-assets
expensive_checks: "1"
instrument_tests: ${{ fromJson('["0", "1"]')[inputs.do_instrumentation] }}
timeout_minutes: 180
TestITC1600:
name: 🧪 Test ITC1600 ${{ matrix.name }}
needs:
- BuildInstaller
- CompilationTest
- TestWithoutHardware
strategy:
matrix:
include:
- experiment: Packages/tests/HardwareBasic/HardwareBasic-ITC1600.pxp
name: HardwareBasic
- experiment: Packages/tests/HardwareAnalysisFunctions/HardwareAnalysisFunctions-ITC1600.pxp
name: HardwareAnalysisFunctions
uses: ./.github/workflows/test-igor-workflow.yml
with:
job_name: 🧪 Test ITC1600 ${{ matrix.name }}
overwrite_job_name: ${{ inputs.is_called_workflow || false }}
experiment: ${{ matrix.experiment }}
target: "[ 'self-hosted', 'Windows', 'IgorPro', 'ITC1600' ]"
artifact_name: TestITC1600-${{ matrix.name }}-assets
expensive_checks: "1"
instrument_tests: ${{ fromJson('["0", "1"]')[inputs.do_instrumentation] }}
timeout_minutes: 180
ValidateNwb:
name: 👮🏼 Validate NWBv2
runs-on: [ self-hosted, Linux, Docker ]
needs:
- TestITC18
- TestITC1600
- TestNI
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Initial repo config
run: tools/initial-repo-config.sh
- name: Download ITC18-USB artifacts
uses: actions/download-artifact@v4
with:
pattern: TestITC18-*
- name: Download ITC1600 artifacts
uses: actions/download-artifact@v4
with:
pattern: TestITC1600-*
- name: Download NI artifacts
uses: actions/download-artifact@v4
with:
pattern: TestNI-*
- name: Validate and read NWBv2 files
run: tools/nwb-read-tests/run.sh
FTPUpload:
name: 📦 FTP Upload Artifacts
runs-on: [ self-hosted, Linux, Docker ]
if: ${{ !cancelled() && !inputs.is_called_workflow}}
needs:
# All jobs that create new artifacts
- Ipt
- BuildInstaller
- CompilationEachCommitTest
- CompilationTest
- Documentation
- TestWithoutHardware
- TestNI
- TestITC18
- TestITC1600
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initial repo config
run: tools/initial-repo-config.sh
- name: Download all artifacts
id: download
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Flatten artifact structure
run: |
find "${{ steps.download.outputs.download-path }}" -mindepth 1 -maxdepth 1 -type d |\
xargs -I {} tools/ftp-upload/flatten-files.sh "{}"
- name: Compress some artifacts
run: tools/ftp-upload/compress-files.sh "${{ steps.download.outputs.download-path }}"
- name: Upload artifacts using FTP
run: |
tools/ftp-upload/upload-files.sh \
-s "${{ vars.GHA_MIES_FTP_ARTEFACT_STORAGE_DNS }}" \
-u "${{ secrets.GHA_MIES_FTP_ARTEFACT_STORAGE_USER }}" \
-p "${{ secrets.GHA_MIES_FTP_ARTEFACT_STORAGE_PWD }}" \
-d "${{ steps.download.outputs.download-path }}" \
-t "branch/$(echo "${{ github.ref_name }}" | sed "s@/@_@g")/${{ github.sha }}/${{ github.run_attempt }}"