Skip to content

Commit 72a1a89

Browse files
authored
Merge pull request #54 from bonachea/ci-improvements
CI expansion in GitHub Actions
2 parents cef1e27 + 7624adc commit 72a1a89

File tree

5 files changed

+115
-36
lines changed

5 files changed

+115
-36
lines changed

.github/workflows/CI.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
6+
jobs:
7+
build:
8+
name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }})
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04]
14+
compiler: [ gfortran ]
15+
version: [ 12, 13, 14 ]
16+
extra_flags: [ -ffree-line-length-0 ]
17+
include:
18+
# https://hub.docker.com/r/phhargrove/llvm-flang/tags
19+
- os: ubuntu-24.04
20+
compiler: flang
21+
version: 20
22+
extra_flags: -g
23+
container: phhargrove/llvm-flang:20.1.0-1
24+
- os: ubuntu-24.04
25+
compiler: flang
26+
version: 19
27+
extra_flags: -g -mmlir -allow-assumed-rank
28+
container: phhargrove/llvm-flang:19.1.1-1
29+
# - os: ubuntu-24.04
30+
# compiler: flang
31+
# version: new
32+
# container: gmao/llvm-flang:latest
33+
# extra_flags: -g
34+
35+
exclude:
36+
- os: ubuntu-22.04
37+
version: 13 # no package available
38+
- os: ubuntu-22.04
39+
version: 14 # no package available
40+
41+
container:
42+
image: ${{ matrix.container }}
43+
44+
env:
45+
GCC_VERSION: ${{ matrix.version }}
46+
FC: ${{ matrix.compiler }}
47+
FPM_FLAGS: --profile release --verbose
48+
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
52+
53+
- name: Install Dependencies Ubuntu
54+
if: ${{ contains(matrix.os, 'ubuntu') && matrix.compiler == 'gfortran' && 0 }}
55+
run: |
56+
sudo apt-get update
57+
sudo apt list -a 'gfortran-*'
58+
sudo apt install -y gfortran-${GCC_VERSION} build-essential
59+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
60+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_VERSION}
61+
62+
- name: Setup Compilers
63+
run: |
64+
set -x
65+
if test "$FC" = "flang" ; then \
66+
echo "FPM_FC=flang-new" >> "$GITHUB_ENV" ; \
67+
else \
68+
echo "FPM_FC=gfortran-${GCC_VERSION}" >> "$GITHUB_ENV" ; \
69+
fi
70+
71+
- name: Setup FPM
72+
uses: fortran-lang/setup-fpm@main
73+
if: ${{ matrix.os != 'macos-14' }}
74+
with:
75+
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
77+
- name: Build FPM
78+
if: ${{ matrix.os == 'macos-14' }} # no arm64 fpm distro, build from source
79+
run: |
80+
set -x
81+
curl --retry 5 -LOsS https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0.F90
82+
mkdir fpm-temp
83+
gfortran-14 -o fpm-temp/fpm fpm-0.11.0.F90
84+
echo "PATH=`pwd`/fpm-temp:${PATH}" >> "$GITHUB_ENV"
85+
86+
- name: Version info
87+
run: |
88+
set -x
89+
echo == TOOL VERSIONS ==
90+
uname -a
91+
if test -r /etc/os-release ; then cat /etc/os-release ; fi
92+
${FPM_FC} --version
93+
fpm --version
94+
95+
- name: Build and Test (Assertions OFF)
96+
run: |
97+
set -x
98+
fpm test ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}"
99+
fpm run --example false-assertion ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}"
100+
fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}"
101+
102+
- name: Build and Test (Assertions ON)
103+
env:
104+
FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERTIONS
105+
run: |
106+
set -x
107+
fpm test ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}"
108+
( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" ; test $? = 1 )
109+
( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" ; test $? = 1 )
110+
111+

.github/workflows/deploy-docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on: [push, pull_request]
44

55

66
jobs:
7-
Build:
7+
build:
8+
name: Build and Deploy Documentation
89
runs-on: ubuntu-22.04
910

1011
env:

test/run-false-assertion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
output=$(fpm run --example false-assertion --compiler flang-new --flag '-mmlir -allow-assumed-rank -O3 -DASSERTIONS' > /dev/null 2>&1)
3-
echo $?
3+
echo $? > build/exit_status

test/test-assert-subroutine-error-termination.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ program test_assert_subroutine_error_termination
2121
#elif NAGFOR
2222
command = "fpm run --example false-assertion --compiler nagfor --flag '-DASSERTIONS -fpp' > /dev/null 2>&1", &
2323
#elif __flang__
24-
command = "./test/run-false-assertion.sh | fpm run --example check-exit-status", &
24+
command = "./test/run-false-assertion.sh", &
2525
#elif __INTEL_COMPILER
2626
command = "./test/run-false-assertion-intel.sh | fpm run --example check-exit-status", &
2727
#elif _CRAYFTN

0 commit comments

Comments
 (0)