-
Notifications
You must be signed in to change notification settings - Fork 22
520 lines (467 loc) · 16.8 KB
/
basic_build.yml
File metadata and controls
520 lines (467 loc) · 16.8 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
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
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
name: Basic Build
run-name: "[${{ github.actor }}]: ${{ github.event_name }} to ${{ github.ref_name }}"
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: Build (${{ matrix.label }})
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- label: linux-x86_64-gfortran
runs_on: ubuntu-22.04
compiler: gcc
fc: gfortran
- label: linux-aarch64-gfortran
runs_on: ubuntu-22.04-arm
compiler: gcc
fc: gfortran
- label: macos-x86_64-gfortran
runs_on: macos-15-intel
compiler: gcc
fc: gfortran-14
- label: macos-arm64-gfortran
runs_on: macos-14
compiler: gcc
fc: gfortran-14
- label: windows-amd64-ifx
runs_on: windows-2022
compiler: intel
version: "2025.2"
fc: ifx
- label: windows-amd64-ifort
runs_on: windows-2022
compiler: intel-classic
version: "2021.10"
fc: ifort
- label: windows-amd64-gfortran
runs_on: windows-2022
compiler: gcc
fc: gfortran
defaults:
run:
shell: bash
steps:
- name: Check out CEA
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up GNU Fortran compiler (Linux)
if: runner.os == 'Linux' && matrix.compiler == 'gcc'
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ gfortran
- name: Set up Fortran compiler (macOS)
if: runner.os == 'macOS' && matrix.compiler == 'gcc'
run: |
brew update
brew install gcc@14
- name: Set up Intel oneAPI compiler (Windows)
if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Resolve Intel compiler path
if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')
shell: pwsh
run: |
$compiler = "${{ matrix.fc }}"
$resolved = $null
$cmd = Get-Command $compiler -ErrorAction SilentlyContinue
if ($cmd) {
$resolved = $cmd.Source
} else {
$candidates = Get-ChildItem -Path "C:\Program Files (x86)\Intel\oneAPI\compiler" -Filter "$compiler.exe" -Recurse -ErrorAction SilentlyContinue | Sort-Object FullName -Descending
if ($candidates.Count -gt 0) {
$resolved = $candidates[0].FullName
}
}
if (-not $resolved) {
Write-Error "Unable to find $compiler.exe in PATH or oneAPI install path."
exit 1
}
"FC=$resolved" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
[System.IO.Path]::GetDirectoryName($resolved) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Set up MSYS2 (Windows gfortran)
if: runner.os == 'Windows' && matrix.compiler == 'gcc'
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-ucrt-x86_64-gcc-fortran
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
- name: Export MinGW gfortran path
if: runner.os == 'Windows' && matrix.compiler == 'gcc'
run: |
echo "C:/msys64/ucrt64/bin" >> "$GITHUB_PATH"
- name: Remove MinGW/MSYS paths for Intel Windows builds
if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')
shell: pwsh
run: |
$parts = $env:PATH -split ';'
$clean = $parts | Where-Object { $_ -and ($_ -notmatch 'mingw') -and ($_ -notmatch 'msys') -and ($_ -notmatch 'strawberry') }
"PATH=$($clean -join ';')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install ninja setuptools numpy cython
- name: Record toolchain info
run: |
git --version
cmake --version
ninja --version
if command -v gfortran &> /dev/null; then gfortran --version; fi
if [ -n "${FC}" ]; then
FC_BASENAME="$(basename "${FC}")"
case "${FC_BASENAME}" in
ifort|ifort.exe|ifx|ifx.exe)
"${FC}" /help > /dev/null || true
;;
*)
"${FC}" --version || true
;;
esac
fi
- name: Configure (Non-Intel Windows)
if: runner.os != 'Windows' || matrix.compiler == 'gcc'
run: |
FC_COMPILER="${FC:-${{ matrix.fc }}}"
cmake -S . -B build -G Ninja \
-DCMAKE_Fortran_COMPILER="${FC_COMPILER}" \
-DCMAKE_BUILD_TYPE=Release \
-DCEA_BUILD_TESTING=OFF \
-DCEA_ENABLE_BIND_C=ON \
-DCEA_ENABLE_BIND_CXX=OFF \
-DCEA_ENABLE_BIND_PYTHON=OFF \
-DCEA_ENABLE_BIND_MATLAB=OFF \
-DCEA_ENABLE_BIND_EXCEL=OFF
- name: Configure (Windows Intel)
if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 >nul
cmake -S . -B build -G Ninja ^
-DCMAKE_Fortran_COMPILER="%FC%" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCEA_BUILD_TESTING=OFF ^
-DCEA_ENABLE_BIND_C=ON ^
-DCEA_ENABLE_BIND_CXX=OFF ^
-DCEA_ENABLE_BIND_PYTHON=OFF ^
-DCEA_ENABLE_BIND_MATLAB=OFF ^
-DCEA_ENABLE_BIND_EXCEL=OFF
- name: Build (Non-Intel Windows)
if: runner.os != 'Windows' || matrix.compiler == 'gcc'
run: |
cmake --build build
- name: Build (Windows Intel)
if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 >nul
cmake --build build
- name: Run smoke test (Unix)
if: runner.os != 'Windows'
run: |
./build/source/cea -h
- name: Run smoke test (Windows)
if: runner.os == 'Windows' && matrix.compiler == 'gcc'
run: |
./build/source/cea.exe -h
- name: Run smoke test (Windows Intel)
if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic')
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 >nul
.\build\source\cea.exe -h
- name: Verify C ABI library output (Unix)
if: runner.os != 'Windows'
run: |
ls -la build/source/bind/c
ls -la build/source/bind/c/libcea_bindc.* || ls -la build/source/bind/c/cea_bindc.*
- name: Verify C ABI library output (Windows)
if: runner.os == 'Windows'
run: |
ls -la build/source/bind/c
ls -la build/source/bind/c/*cea_bindc*
- name: Upload CLI executable artifact
uses: actions/upload-artifact@v4
with:
name: cea-cli-${{ matrix.label }}
if-no-files-found: error
path: |
build/source/cea
build/source/cea.exe
build/thermo.lib
build/trans.lib
- name: Upload C ABI library artifact
uses: actions/upload-artifact@v4
with:
name: cea-bindc-${{ matrix.label }}
if-no-files-found: error
path: |
source/bind/c/cea.h
source/bind/c/cea_enum.h
build/source/bind/c/libcea_bindc.so
build/source/bind/c/libcea_bindc.dylib
build/source/bind/c/cea_bindc.dll
build/source/bind/c/cea_bindc.lib
build/source/bind/c/libcea_bindc.dll.a
pfunit-tests:
name: pFUnit (ubuntu-22.04 / gcc 11)
runs-on: ubuntu-22.04
steps:
- name: Check out CEA
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Fortran compiler
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: "11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install ninja setuptools numpy cython
- name: Build CEA + GFE (pFUnit)
run: |
scripts/develop.sh -G Ninja
- name: Rebuild data libraries (compiler-native)
run: |
pushd data
../build-dev/source/cea --compile-thermo thermo.inp
../build-dev/source/cea --compile-trans trans.inp
popd
- name: Run pFUnit tests
env:
GFORTRAN_ERROR_BACKTRACE: "1"
GFORTRAN_UNBUFFERED_ALL: "1"
run: |
ulimit -c unlimited
ctest --output-on-failure --test-dir build-dev -V
python-tests:
name: Python (ubuntu-22.04 / gcc 11)
runs-on: ubuntu-22.04
steps:
- name: Check out CEA
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Fortran compiler
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: "11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install ninja pytest setuptools numpy cython
- name: Install CEA (editable)
run: |
python -m pip install -e .
- name: Import extension (no init)
env:
CEA_SKIP_INIT: "1"
run: |
python - <<'PY'
import cea
import cea.lib.libcea
print("cea import ok")
PY
- name: Run pytest
env:
CEA_DATA_DIR: ${{ github.workspace }}/data
run: |
pytest source/bind/python/tests
release-artifacts:
name: Release CLI + C ABI Artifacts
needs: build
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-dist
merge-multiple: false
- name: Prepare release assets (unique names)
run: |
mkdir -p release-assets
while IFS= read -r -d '' file; do
rel="${file#release-dist/}"
artifact="${rel%%/*}"
subpath="${rel#*/}"
asset_name="${artifact}__${subpath//\//__}"
cp "${file}" "release-assets/${asset_name}"
done < <(find release-dist -type f -print0)
- name: Generate SHA256 checksums
run: |
cd release-assets
find . -maxdepth 1 -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Publish GitHub release assets
uses: softprops/action-gh-release@v2
with:
files: release-assets/*
generate_release_notes: true
bindc:
name: Build (${{ matrix.os }} / ${{ matrix.toolchain.ccompiler }} / ${{matrix.toolchain.fcompiler}})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest]
toolchain:
- ccompiler: gcc
cversion: "11"
fcompiler: gcc
fversion: "11"
include:
- os: ubuntu-24.04
toolchain:
ccompiler: gcc
cversion: "13"
fcompiler: gcc
fversion: "13"
- os: ubuntu-22.04
toolchain:
ccompiler: intel
cversion: "2023.1"
fcompiler: intel
fversion: "2023.1"
- os: ubuntu-22.04
toolchain:
ccompiler: intel-classic
cversion: "2021.9"
fcompiler: intel-classic
fversion: "2021.9"
- os: windows-latest
toolchain:
ccompiler: msvc
cversion: latest
fcompiler: intel
fversion: "2025.2"
- os: windows-latest
toolchain:
ccompiler: intel
cversion: "2025.2"
fcompiler: intel
fversion: "2025.2"
defaults:
run:
shell: bash
steps:
- name: Check out CEA
uses: actions/checkout@v6
- name: Check out GFE
if: ${{ runner.os != 'Windows' }}
uses: actions/checkout@v6
with:
repository: Goddard-Fortran-Ecosystem/GFE
path: extern/gfe
submodules: true
- name: Set up Fortran compiler
if: ${{ runner.os != 'Windows' || matrix.toolchain.fcompiler != 'gcc' }}
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ matrix.toolchain.fcompiler }}
version: ${{ matrix.toolchain.fversion }}
- name: Set up Fortran compiler (Windows, gfortran)
if: ${{ runner.os == 'Windows' && matrix.toolchain.fcompiler == 'gcc' }}
run: |
# Use pre-installed MinGW on Windows runners to avoid Chocolatey issues
# GitHub Actions windows-latest runners include MinGW in C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
$mingwPath = "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin"
if (Test-Path $mingwPath) {
echo "$mingwPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "FC=$mingwPath\gfortran.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
# Fallback: search for gfortran in common locations
$gfortran = Get-Command gfortran -ErrorAction SilentlyContinue
if ($gfortran) {
echo "FC=$($gfortran.Source)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
Write-Error "gfortran not found on Windows runner"
exit 1
}
}
shell: pwsh
- name: Set up C Compiler
if: ${{matrix.toolchain.ccompiler == 'msvc'}}
uses: ilammy/msvc-dev-cmd@v1
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install ninja setuptools numpy cython
- name: Record toolchain info
run: |
git --version
cmake --version
ninja --version
if command -v gfortran &> /dev/null; then gfortran --version; fi
if [ -n "${FC}" ]; then "${FC}" --version; fi
- name: Configure and Build GFE
if: ${{ runner.os != 'Windows' }}
run: |
cmake -S extern/gfe -B build/extern/gfe -GNinja \
-DCMAKE_INSTALL_PREFIX=build/install \
-DCMAKE_BUILD_TYPE=Release \
-DSKIP_MPI=YES \
-DSKIP_OPENMP=YES \
-DSKIP_FHAMCREST=YES \
-DSKIP_ESMF=YES \
-DSKIP_ROBUST=YES
cmake --build build/extern/gfe --target install
- name: Configure (linux)
if: ${{runner.os != 'Windows' || matrix.toolchain.ccompiler != 'msvc'}}
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_PREFIX_PATH=build/install \
-DCMAKE_BUILD_TYPE=Debug \
-DCEA_BUILD_TESTING=ON \
-DCEA_ENABLE_BIND_C=ON \
-DCEA_ENABLE_BIND_CXX=OFF \
-DCEA_ENABLE_BIND_PYTHON=OFF \
-DCEA_ENABLE_BIND_MATLAB=OFF \
-DCEA_ENABLE_BIND_EXCEL=OFF \
-DCMAKE_Fortran_FLAGS="-ffree-line-length-none"
- name: Configure (msvc)
if: ${{runner.os == 'Windows' && matrix.toolchain.ccompiler == 'msvc'}}
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCEA_BUILD_TESTING=ON \
-DCEA_ENABLE_BIND_C=ON \
-DCEA_ENABLE_BIND_CXX=OFF \
-DCEA_ENABLE_BIND_PYTHON=OFF \
-DCEA_ENABLE_BIND_MATLAB=OFF \
-DCEA_ENABLE_BIND_EXCEL=OFF \
-DCMAKE_C_COMPILER=cl \
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
- name: Build
run: |
cmake --build build
- name: Run smoke test (Unix)
if: runner.os != 'Windows'
run: |
./build/source/cea -h
- name: Run smoke test (Windows)
if: runner.os == 'Windows'
run: |
./build/source/cea.exe -h
- name: Run ctest
run: ctest --test-dir build --output-on-failure