-
Notifications
You must be signed in to change notification settings - Fork 2
448 lines (372 loc) · 17.2 KB
/
main.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
name: build-and-test
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
#schedule:
# - cron: '*/120 8-18 * * *' # every 2 hours from 8:00 to 18:00 every day
jobs:
##############################################################################
# JOB 1
##############################################################################
build: # current job name
timeout-minutes: 30
# current job matrix. if modified, remember to UPDATE the strategy in the next job
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2022, macos-12, macos-14] # [ubuntu-22.04, windows-2022, macos-13, flyci-macos-14-m2]
toolchain:
- { exe: gfortran, compiler: gcc, version: 13 }
- { exe: ifort, compiler: intel-classic, version: "2021.10" }
- { exe: ifx, compiler: intel, version: "2023.2" }
exclude:
- os: macos-12
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS
- os: macos-14
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS on arm64
- os: macos-14
toolchain: { exe: ifort, compiler: intel-classic, version: "2021.10" } # no support for macOS on arm64
runs-on: ${{ matrix.os }}
steps: # job steps
- name: Check-out repository
uses: actions/checkout@v4
- name: Set up Fortran compiler (FC) [all except Windows + gfortran] # except: use pre-installed gfortran
if: runner.os != 'Windows' || matrix.toolchain.exe != 'gfortran'
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Set up NMake build tool [Windows]
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Upgrade package installer for Python
shell: bash
run: pip install --upgrade pip
- name: Install Python dependences
shell: bash
run: pip install '.[ci,test]' # 'ci' and 'test' extras from pyproject.toml
- name: Fix reinstalling gcc [macOS] # needed because of `brew reinstall gcc`
if: runner.os == 'macOS'
shell: bash
run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV
- name: Create build scripts in scripts/scripts
shell: bash
run: >
python3 pybuild.py
--create-scripts
--platform ${{ runner.os }}
--compiler ${{ matrix.toolchain.exe }}
--mode debug
--bash-syntax
--enable-backslash-escapes
- name: Print build-specific variables
shell: bash
run: scripts/print_build_variables.sh # bash -x scripts/print_build_variables.sh for printing commands
- name: Create CFML and pyCFML directories
shell: bash
run: |
scripts/create_cfml_repo_dir.sh
scripts/create_cfml_build_dir.sh
scripts/create_cfml_dist_dir.sh
scripts/create_pycfml_src_dir.sh
scripts/create_pycfml_build_dir.sh
scripts/create_pycfml_dist_dir.sh
- name: Download CFML repository
shell: bash
run: scripts/download_cfml_repo.sh
- name: Build CFML modules
shell: bash
run: |
scripts/rename_global_deps_file.sh
scripts/build_cfml_modules_obj.sh
scripts/delete_renamed_global_deps_file.sh
- name: Build CFML static library
shell: bash
run: scripts/build_cfml_static_lib.sh
- name: Make CFML distribution
shell: bash
run: scripts/move_built_to_cfml_dist.sh
- name: Build und run CFML functional test programs (incl. benchmarks)
# 1st combination: this always fails with 'Undefined symbols...' error
# 2nd combination: this randomly fails with test__Simple_calc_powder__SrTiO3s 'forrtl: severe (157): Program Exception - access violation'
if: |
(runner.os != 'macOS' || matrix.toolchain.exe != 'ifort')
&&
(runner.os != 'Windows' || matrix.toolchain.exe != 'ifx')
shell: bash
run: |
scripts/build_cfml_test_programs.sh
scripts/copy_cfml_test_programs_to_tests_dir.sh
scripts/run_cfml_functional_tests_no_benchmarks.sh
# # scripts/run_cfml_functional_tests_with_benchmarks.sh
#- name: Push benchmark results to repository
# uses: EndBug/add-and-commit@v9
# with:
# add: '.benchmarks'
# message: 'Auto push benchmark results by GitHub Action for ${{ runner.os }} + ${{ matrix.toolchain.exe }}'
# pull: '--rebase --autostash'
#- name: Copy powder_mod from CFML to pyCFML
# shell: bash
# run: scripts/copy_powder_mod_to_pycfml_repo.sh
- name: Create pyCFML source code
shell: bash
run: scripts/create_pycfml_src.sh
- name: Build pyCFML modules
shell: bash
run: scripts/build_pycfml_modules_obj.sh
- name: Build pyCFML shared obj / dynamic library
shell: bash
run: |
#export LD_LIBRARY_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH="/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11"
export LD_LIBRARY_PATH="/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11"
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11"
export DYLD_FALLBACK_LIBRARY_PATH="/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11"
export DYLD_FALLBACK_FRAMEWORK_PATH="/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib:/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11"
scripts/build_pycfml_lib_obj.sh
scripts/build_pycfml_shared_obj_or_dynamic_lib.sh
- name: Make pyCFML distribution
shell: bash
run: |
scripts/copy_built_to_pycfml_dist.sh
scripts/change_runpath_for_built_pycfml.sh
scripts/copy_extra_libs_to_pycfml_dist.sh
scripts/copy_py_api_files_to_pycfml_dist.sh
scripts/copy_init_file_to_pycfml_dist.sh
scripts/copy_cfml_databases_to_pycfml_dist.sh
- name: Create Python package wheel of pyCFML
shell: bash
run: |
scripts/validate_pyproject_toml.sh
scripts/create_pycfml_python_wheel.sh
scripts/rename_pycfml_python_wheel.sh
scripts/detect_abi3_violations.sh
scripts/check_wheel_contents.sh
- name: Prepare for uploading Python package wheel of pyCFML
shell: bash
run: echo "WHEEL_DIR=$(python3 pybuild.py --print-wheel-dir)" >> $GITHUB_ENV
- name: Upload zipped Python package wheel of pyCFML for next job
uses: actions/upload-artifact@v4
with: # if name or path modified, remember to UPDATE those in the download step of the next job
name: pycfml-wheel_${{ matrix.os }}_${{ matrix.toolchain.exe }} # name (without .zip) of the zip file to be uploaded
path: ${{ env.WHEEL_DIR }} # all files from this directory are zipped
if-no-files-found: "error"
compression-level: 0
##############################################################################
# JOB 2
##############################################################################
tests: # current job name
needs: build # previous job 'build' need to be finished first
if: always() # start this job even if the previous job failed
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2022, macos-12, macos-14] # [ubuntu-22.04, windows-2022, macos-13, flyci-macos-14-m2]
toolchain:
- { exe: gfortran, compiler: gcc, version: 13 }
- { exe: ifort, compiler: intel-classic, version: "2021.10" }
- { exe: ifx, compiler: intel, version: "2023.2" }
exclude:
- os: macos-12
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS
- os: macos-14
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS on arm64
- os: macos-14
toolchain: { exe: ifort, compiler: intel-classic, version: "2021.10" } # no support for macOS on arm64
runs-on: ${{ matrix.os }}
steps: # job steps
- name: Check-out repository
uses: actions/checkout@v4
- name: Set up python environment
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Upgrade package installer for Python
shell: bash
run: python3 -m pip install --upgrade pip
- name: Install Python dependences
shell: bash
run: pip install '.[ci,test]' # 'ci' and 'test' extras from pyproject.toml
- name: Create job step scripts
shell: bash
run: >
python3 pybuild.py
--create-scripts
--platform ${{ runner.os }}
--compiler ${{ matrix.toolchain.exe }}
--mode debug
--bash-syntax
--enable-backslash-escapes
- name: Prepare for downloading Python package wheel of pyCFML
shell: bash
run: echo "WHEEL_DIR=$(python3 pybuild.py --print-wheel-dir)" >> $GITHUB_ENV
- name: Download zipped pyCFML wheel from previous job
uses: actions/download-artifact@v4
with: # name or path are taken from the upload step of the previous job
name: pycfml-wheel_${{ matrix.os }}_${{ matrix.toolchain.exe }} # name (without .zip) of the zipped artifact uploaded on the previous jobs
path: ${{ env.WHEEL_DIR }} # directory to extract downloaded zipped artifacts
- name: Install pyCFML from downloaded Python package wheel (with dev extras)
shell: bash
run: scripts/install_pycfml_from_wheel.sh
- name: Run pyCFML unit tests
shell: bash
run: scripts/run_pycfml_unit_tests.sh
- name: Run pyCFML functional tests
shell: bash
run: scripts/run_pycfml_functional_tests_no_benchmarks.sh
##############################################################################
# JOB 3
##############################################################################
publish: # current job name
needs: tests # previous job 'tests' need to be finished first
if: always() # start this job even if the previous job failed
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2022, macos-12, macos-14] # [ubuntu-22.04, windows-2022, macos-13, flyci-macos-14-m2]
python-version: ['3.10', '3.11', '3.12']
toolchain:
- { exe: gfortran, compiler: gcc, version: 13 }
runs-on: ${{ matrix.os }}
steps: # job steps
- name: Check-out repository
uses: actions/checkout@v4
- name: Declare env variables on push only
if: github.event_name == 'push'
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Declare env variables on pull_request only
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV
- name: Set up Fortran compiler (FC) [all except Windows + gfortran] # except: use pre-installed gfortran
if: runner.os != 'Windows' || matrix.toolchain.exe != 'gfortran'
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Set up NMake build tool [Windows]
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade package installer for Python
shell: bash
run: pip install --upgrade pip
- name: Install Python dependences
shell: bash
run: pip install '.[ci,test]' # 'ci' and 'test' extras from pyproject.toml
- name: Fix reinstalling gcc [macOS] # needed because of `brew reinstall gcc`
if: runner.os == 'macOS'
shell: bash
run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV
- name: Create build scripts in scripts/scripts
shell: bash
run: >
python3 pybuild.py
--create-scripts
--platform ${{ runner.os }}
--compiler ${{ matrix.toolchain.exe }}
--mode release
--bash-syntax
--enable-backslash-escapes
- name: Print some build-specific variables
shell: bash
run: scripts/print_build_variables.sh # bash -x scripts/print_build_variables.sh for printing commands
- name: Create scripts, CFML and pyCFML directories
shell: bash
run: |
scripts/create_cfml_repo_dir.sh
scripts/create_cfml_build_dir.sh
scripts/create_cfml_dist_dir.sh
scripts/create_pycfml_src_dir.sh
scripts/create_pycfml_build_dir.sh
scripts/create_pycfml_dist_dir.sh
- name: Download CFML repository
shell: bash
run: scripts/download_cfml_repo.sh
- name: Build CFML modules
shell: bash
run: |
scripts/rename_global_deps_file.sh
scripts/build_cfml_modules_obj.sh
scripts/delete_renamed_global_deps_file.sh
- name: Build CFML static library
shell: bash
run: scripts/build_cfml_static_lib.sh
- name: Make CFML distribution
shell: bash
run: scripts/move_built_to_cfml_dist.sh
- name: Create pyCFML source code
shell: bash
run: scripts/create_pycfml_src.sh
- name: Build pyCFML modules
shell: bash
run: scripts/build_pycfml_modules_obj.sh
- name: Build pyCFML shared obj / dynamic library
shell: bash
run: |
scripts/build_pycfml_lib_obj.sh
scripts/build_pycfml_shared_obj_or_dynamic_lib.sh
- name: Make pyCFML distribution
shell: bash
run: |
scripts/copy_built_to_pycfml_dist.sh
scripts/change_runpath_for_built_pycfml.sh
scripts/copy_extra_libs_to_pycfml_dist.sh
scripts/copy_py_api_files_to_pycfml_dist.sh
scripts/copy_init_file_to_pycfml_dist.sh
scripts/copy_cfml_databases_to_pycfml_dist.sh
- name: Create Python package wheel of pyCFML
shell: bash
run: |
scripts/validate_pyproject_toml.sh
scripts/create_pycfml_python_wheel.sh
scripts/rename_pycfml_python_wheel.sh
- name: Prepare for uploading Python package wheel of pyCFML
shell: bash
run: |
echo "WHEEL_DIR=$(python3 pybuild.py --print-wheel-dir)" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(python3 pybuild.py --print-release-version)" >> $GITHUB_ENV
echo "RELEASE_TITLE=$(python3 pybuild.py --print-release-title)" >> $GITHUB_ENV
- name: Upload Python package wheel to releases (non-master branch)
if: github.event_name == 'push' && env.BRANCH_NAME != 'master'
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "${{ env.WHEEL_DIR }}/*.whl"
tag: ${{ env.BRANCH_NAME }}
name: ${{ env.BRANCH_NAME }}
bodyFile: "RELEASE.md"
- name: Upload Python package wheel to releases (master branch)
if: github.event_name == 'push' && env.BRANCH_NAME == 'master'
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "${{ env.WHEEL_DIR }}/*.whl"
tag: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_TITLE }}
bodyFile: "RELEASE.md"