-
Notifications
You must be signed in to change notification settings - Fork 12
414 lines (369 loc) · 15.4 KB
/
Copy pathbuild.yml
File metadata and controls
414 lines (369 loc) · 15.4 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
name: Build
on:
push:
paths-ignore: &paths_ignore
- 'docs/**'
- '**.txt'
- '**.md'
pull_request:
paths-ignore: *paths_ignore
concurrency:
# De-duplicate concurrent workflow runs on the same branch/ref
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash --noprofile --norc -e -x -o pipefail {0}
strategy:
fail-fast: false
matrix:
os: [ macos-14, macos-15, macos-15-intel, macos-26, macos-26-intel, ubuntu-24.04, ubuntu-26.04-arm ]
compiler: [ gfortran ]
version: [ 12, 13, 14, 15, 16 ]
extra_flags: [ -g ]
exclude:
# Homebrew removed Intel bottles for gcc@16
- os: macos-15-intel
version: 16
- os: macos-26-intel
version: 16
include:
- os: ubuntu-24.04
compiler: gfortran
version: 9
- os: ubuntu-24.04
compiler: gfortran
version: 10
- os: ubuntu-24.04
compiler: gfortran
version: 11
- os: ubuntu-22.04
compiler: gfortran
version: 12 # no package available for gfortran 13+
# --- LLVM flang coverage ---
- os: macos-15
compiler: flang
version: 23
- os: macos-26
compiler: flang
version: 23
# - os: macos-15-intel
# compiler: flang
# version: 23
# - os: macos-26-intel
# compiler: flang
# version: 23
# https://hub.docker.com/r/snowstep/llvm/tags
- os: ubuntu-24.04
compiler: flang
version: latest
container: snowstep/llvm:noble
- os: ubuntu-22.04
compiler: flang
version: latest
container: snowstep/llvm:jammy
# https://hub.docker.com/r/phhargrove/llvm-flang/tags
- os: ubuntu-24.04-arm
compiler: flang
version: 23
container: phhargrove/llvm-flang:23.1.0-latest-arm64
- os: ubuntu-24.04
compiler: flang
version: 23
container: phhargrove/llvm-flang:23.1.0-latest
- os: ubuntu-24.04
compiler: flang
version: 22
container: phhargrove/llvm-flang:22.1.0-latest
- os: ubuntu-24.04
compiler: flang
version: 21
container: phhargrove/llvm-flang:21.1.0-latest
- os: ubuntu-24.04
compiler: flang
version: 20
container: phhargrove/llvm-flang:20.1.0-latest
- os: ubuntu-24.04
compiler: flang
version: 19
extra_flags: -g -mmlir -allow-assumed-rank
container: phhargrove/llvm-flang:19.1.1-latest
# - os: ubuntu-24.04
# compiler: flang
# version: new
# container: gmao/llvm-flang:latest
# --- Intel coverage ---
# https://hub.docker.com/r/intel/oneapi-toolkit/tags
- os: ubuntu-24.04
compiler: ifx
version: latest
container: intel/oneapi-toolkit:latest
- os: ubuntu-24.04
compiler: ifx
version: 2026.0.0
container: intel/oneapi-toolkit:2026.0.0-devel-ubuntu24.04
# https://hub.docker.com/r/intel/fortran-essentials/tags
- os: ubuntu-24.04
compiler: ifx
version: 2025.3.0
container: intel/fortran-essentials:2025.3.0-0-devel-ubuntu24.04
- os: ubuntu-24.04
compiler: ifx
version: 2025.2.0
container: intel/fortran-essentials:2025.2.0-0-devel-ubuntu24.04
- os: ubuntu-24.04
compiler: ifx
version: 2025.1.0
container: intel/fortran-essentials:2025.1.0-0-devel-ubuntu24.04
- os: ubuntu-22.04
compiler: ifx
version: 2025.0.0
container: intel/fortran-essentials:2025.0.0-0-devel-ubuntu22.04
# --- LFortran coverage ---
# https://hub.docker.com/r/phhargrove/lfortran/tags
- os: ubuntu-24.04
compiler: lfortran
version: 0.55.0
container: phhargrove/lfortran:0.55.0-1
#
# - os: ubuntu-24.04
# compiler: lfortran
# version: 0.56.0
# container: phhargrove/lfortran:0.56.0-1
#
# - os: ubuntu-24.04
# compiler: lfortran
# version: 0.57.0
# container: phhargrove/lfortran:0.57.0-1
#
# - os: ubuntu-24.04
# compiler: lfortran
# version: 0.58.0
# container: phhargrove/lfortran:0.58.0-1
#
# - os: ubuntu-24.04
# compiler: lfortran
# version: 0.59.0
# container: phhargrove/lfortran:0.59.0-1
#
# - os: ubuntu-24.04
# compiler: lfortran
# version: 0.60.0
# container: phhargrove/lfortran:0.60.0-1
#
# - os: ubuntu-24.04
# compiler: lfortran
# version: 0.61.0
# container: phhargrove/lfortran:0.61.0-1
- os: ubuntu-24.04
compiler: lfortran
version: 0.62.0
container: phhargrove/lfortran:0.62.0-1
# https://github.com/lfortran/lfortran/pkgs/container/lfortran
- os: ubuntu-22.04
compiler: lfortran
version: 0.63.0
container: ghcr.io/lfortran/lfortran:v0.63.0
- os: ubuntu-22.04
compiler: lfortran
version: 0.64.0
container: ghcr.io/lfortran/lfortran:v0.64.0
- os: ubuntu-22.04
compiler: lfortran
version: 0.65.0
container: ghcr.io/lfortran/lfortran:v0.65.0
- os: ubuntu-22.04
compiler: lfortran
version: 0.66.0
container: ghcr.io/lfortran/lfortran:v0.66.0
- os: ubuntu-22.04
compiler: lfortran
version: latest
container: ghcr.io/lfortran/lfortran:latest
container:
image: ${{ matrix.container }}
env:
COMPILER_VERSION: ${{ matrix.version }}
FC: ${{ matrix.compiler }}
FFLAGS: ${{ matrix.extra_flags }}
FPM_FLAGS: --profile release --verbose
CURL_OPTIONS: --retry 10 --retry-all-errors --fail -L
BREW_WARNING_FILTER: 's/^[[:punct:]]*warning[[:punct:]]*(You are using macOS)/warn: \1/i'
CHECK_ASSERT: --flag -DASSERTIONS 2>&1 | tee output ; test ${PIPESTATUS[0]} = $ERROR_STOP_CODE && grep -q "Assertion failure" output
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install shell functions
run: |
mkdir -p ~/.bash_helpers
cat << 'EOF' > ~/.bash_helpers/custom_functions.sh
retry() {
local retry_cnt=0
local retry_delay
while ! "$@" ; do
retry_cnt=$(expr $retry_cnt + 1)
if [[ $retry_cnt > 5 ]] ; then exit 1 ; fi
( set +x ;
echo "::warning::Command failed: <$@> Pausing before retry $retry_cnt..." );
retry_delay=$(( 5 ** retry_cnt ))
if [[ $retry_delay > 600 ]] ; then retry_delay=600 ; fi
sleep $retry_delay
done
}
EOF
# Register file in BASH_ENV so it automatically loads in all future steps
echo "BASH_ENV=~/.bash_helpers/custom_functions.sh" >> $GITHUB_ENV
- name: Install Ubuntu Native Dependencies
if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }}
run: |
retry sudo apt-get update
#sudo apt list -a 'gfortran-*'
retry sudo apt install -y build-essential
if [[ ${COMPILER_VERSION} -lt 15 ]] || type -p gfortran-${COMPILER_VERSION} ; then
retry sudo apt install -y gfortran-${COMPILER_VERSION}
else
curl $CURL_OPTIONS https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install-homebrew.sh
chmod +x install-homebrew.sh
env CI=1 ./install-homebrew.sh
HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
retry ${HOMEBREW_PREFIX}/bin/brew install -v gcc@${COMPILER_VERSION} binutils
ls -al ${HOMEBREW_PREFIX}/bin
echo "PATH=${HOMEBREW_PREFIX}/bin:${PATH}" >> "$GITHUB_ENV"
: Homebrew GCC@15 needs binutils 2.44+
HOMEBREW_BINUTILS=$(ls -d ${HOMEBREW_PREFIX}/Cellar/binutils/2.*/bin )
ls -al ${HOMEBREW_BINUTILS}
echo "FFLAGS=$FFLAGS -B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV"
echo "CFLAGS=$CFLAGS -B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV"
echo "CXXFLAGS=$CXXFLAGS -B ${HOMEBREW_BINUTILS}" >> "$GITHUB_ENV"
fi
- name: Install Ubuntu Container Dependencies
if: ${{ contains(matrix.os, 'ubuntu') && matrix.container != '' && !contains(matrix.container, 'phhargrove') }}
run: |
retry apt update
retry apt install -y build-essential # pkg-config make git curl
# Add container lfortran to PATH:
if test "$FC" = "lfortran"; then
echo "/app/bin" >> "$GITHUB_PATH"
ls -alh /app/bin
ls -alh /app/share/lfortran/lib/
fi
- name: Fix macOS Homebrew Configuration
if: ${{ contains(matrix.os, 'macos') }}
run: |
# silence Homebrew tap trust warnings:
(set +e ; brew untap -f aws/tap hashicorp/tap 2>&1 | perl -pe 's/^::*//;s/^##*//' ; brew trust azure/bicep ; echo )
# set some Homebrew knobs to accelerate installation
# but only when we are not simulating the user environment brew-via-install workflow
if [[ -z "${{ matrix.brew_via_install }}" ]] ; then
echo HOMEBREW_NO_ANALYTICS=1 >> "$GITHUB_ENV"
echo HOMEBREW_NO_AUTO_UPDATE=1 >> "$GITHUB_ENV"
echo HOMEBREW_NO_GITHUB_API=1 >> "$GITHUB_ENV"
echo HOMEBREW_NO_INSTALL_CLEANUP=1 >> "$GITHUB_ENV"
fi
- name: Install macOS Dependencies
if: contains(matrix.os, 'macos')
run: |
retry brew update
# fpm binary distribution for macOS requires gfortran shared libraries from gcc@12
retry brew install gcc@12 \
2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0
if [[ ${{ matrix.compiler }} == 'gfortran' && ${COMPILER_VERSION} -gt 15 ]] ; then
retry brew install gcc@${COMPILER_VERSION} \
2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0
fi
- name: Install LLVM flang on macOS
if: contains(matrix.os, 'macos') && matrix.compiler == 'flang'
run: |
retry brew install llvm@${COMPILER_VERSION} flang \
2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0
# workaround issue #228: clang cannot find homebrew flang's C header
for p in /opt/homebrew /usr/local $(brew --prefix) ; do find $p/Cellar/flang -name ISO_Fortran_binding.h 2>/dev/null || true ; done
echo "CFLAGS=-I$(dirname $(find $(brew --prefix)/Cellar/flang -name ISO_Fortran_binding.h | head -1)) ${CFLAGS}" >> "$GITHUB_ENV"
# Prepend homebrew clang to PATH:
echo "PATH=$(brew --prefix)/opt/llvm/bin:${PATH}" >> "$GITHUB_ENV"
- name: Setup Compilers
run: |
ERROR_STOP_CODE=${{ matrix.error_stop_code || 1}}
if test "$FC" = "flang" ; then
echo "FPM_FC=flang-new" >> "$GITHUB_ENV"
elif test "$FC" = "ifx" ; then
ERROR_STOP_CODE=128
echo "FPM_FC=ifx" >> "$GITHUB_ENV"
elif test "$FC" = "lfortran" ; then
echo "FPM_FC=lfortran" >> "$GITHUB_ENV"
echo "FFLAGS=--cpp $FFLAGS" >> "$GITHUB_ENV"
echo "FPM_FLAGS=--profile debug --verbose" >> "$GITHUB_ENV" ; : fpm 0.13 workaround
else
echo "FPM_FC=gfortran-${COMPILER_VERSION}" >> "$GITHUB_ENV"
echo "FFLAGS=-ffree-line-length-0 $FFLAGS" >> "$GITHUB_ENV"
fi
if [[ "${{ matrix.container }}" =~ "snowstep/llvm" ]] ; then
echo "LD_LIBRARY_PATH=/usr/lib/llvm-22/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
fi
echo "ERROR_STOP_CODE=${ERROR_STOP_CODE}" >> "$GITHUB_ENV"
- name: Setup FPM
if: ${{ !(runner.os == 'Linux' && runner.arch == 'ARM64') }}
uses: fortran-lang/setup-fpm@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fpm-version: latest
- name: Build FPM
if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
run: |
export FPM_VERSION=0.13.0
for suff in -14 -15 -16 "" -13 -12 ; do
GFORTRAN=gfortran$suff
if type -P $GFORTRAN ; then break ; fi
done
[[ -n "$GFORTRAN" ]]
mkdir -p fpm-temp/bin
cd fpm-temp
curl $CURL_OPTIONS https://github.com/fortran-lang/fpm/releases/download/v$FPM_VERSION/fpm-$FPM_VERSION.F90 -o fpm.F90
$GFORTRAN -fopenmp -o bin/fpm fpm.F90
echo "PATH=$PWD/bin:${PATH}" >> "$GITHUB_ENV"
- name: Version info
run: |
set +x
echo == TOOL VERSIONS ==
echo Platform version info:
uname -a
if test -r /etc/os-release ; then grep -e NAME -e VERSION /etc/os-release ; fi
if test -x /usr/bin/sw_vers ; then /usr/bin/sw_vers ; fi
echo
echo PATH="$PATH"
for tool in ${FPM_FC} fpm ; do
( echo ; set -x ; w=$(which $tool) ; ls -al $w ; ls -alhL $w ; $tool --version )
done
- name: Build and Test (Assertions OFF)
run: |
fpm test ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example simple-assertions ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
- name: Build and Test (Assertions ON)
run: |
fpm test ${FPM_FLAGS} --flag "$FFLAGS" --flag -DASSERTIONS
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example simple-assertions ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
- name: Test Assertions w/ Parallel Callbacks
env:
FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DTEST_PARALLEL_CALLBACKS
run: |
fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
- name: Test Assertions w/ ASSERT_MULTI_IMAGE
if: matrix.compiler == 'gfortran'
env:
FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -fcoarray=single --flag -DASSERT_MULTI_IMAGE
run: |
fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS"
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS"
( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )
( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT )