-
-
Notifications
You must be signed in to change notification settings - Fork 5
225 lines (194 loc) · 7.46 KB
/
linux-ci.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
name: linux-ci
on:
push:
branches:
- master
- main
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
pull_request:
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
env:
# Modify this variable to change the ifort compiler version - do NOT hardcode the version
# anywhere else!
INTEL_ONEAPI_VERSION: 2023.2.1
jobs:
linux-tests:
timeout-minutes: 8
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: coverage
memcheck: true
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: ifx
ccompiler: icx-cc
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: ifort
ccompiler: icx-cc
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: fpm
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash
build_type: fpm
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash
build_type: fpm
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash
build_type: fpm
memcheck: false
- os: ubuntu-22.04
fcompiler: ifx
ccompiler: icx-cc
shell: bash
build_type: fpm
memcheck: false
- os: ubuntu-22.04
fcompiler: ifort
ccompiler: icx-cc
shell: bash
build_type: fpm
memcheck: false
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Intel oneAPI Fortran compiler
if: ${{ startsWith(matrix.fcompiler,'if') }}
run: |
# download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# update package index and install Fortran compiler
sudo apt update -y
sudo apt-get -y install intel-oneapi-compiler-fortran-$INTEL_ONEAPI_VERSION intel-oneapi-dpcpp-cpp-$INTEL_ONEAPI_VERSION
# set environment variables and make them persistent across steps
. /opt/intel/oneapi/setvars.sh
env | grep oneapi >> $GITHUB_ENV
- name: Use existing Intel oneAPI Fortran compiler
if: ${{ startsWith(matrix.fcompiler,'if') }}
run: |
# set environment variables and make them persistent across steps
. /opt/intel/oneapi/setvars.sh
env | grep oneapi >> $GITHUB_ENV
- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: Build with Cmake
if: ${{ matrix.build_type != 'fpm' }}
run: |
mkdir build
cd build
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../
make VERBOSE=1
- name: fpm tests (ifx)
if: ${{ (matrix.build_type == 'fpm') && (matrix.fcompiler == 'ifx') }}
run: |
wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64
chmod +x ./fpm-0.9.0-linux-x86_64 && mv ./fpm-0.9.0-linux-x86_64 fpm
./fpm install --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --flag "-debug all -check all,nouninit -traceback"
./fpm test --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --flag "-debug all -check all,nouninit -traceback"
./fpm run --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --flag "-debug all -check all,nouninit -traceback" --example "*"
- name: fpm tests
if: ${{ (matrix.build_type == 'fpm') && (matrix.fcompiler != 'ifx') }}
run: |
wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64
chmod +x ./fpm-0.9.0-linux-x86_64 && mv ./fpm-0.9.0-linux-x86_64 fpm
./fpm install --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
./fpm test --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
./fpm run --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --example "*"
- name: Initialize coverage counters
if: ${{ matrix.build_type == 'coverage' }}
run: |
sudo apt-get update -y && sudo apt-get install lcov
lcov --no-external \
--directory /home/runner/work/feq-parse \
--zerocounters
- name: Run ctests
if: ${{ matrix.build_type != 'fpm' }}
run: |
cd build/test
ctest || ctest --rerun-failed --output-on-failure
- name: Create coverage report
if: ${{ matrix.build_type == 'coverage' }}
run: |
lcov --no-external \
--capture \
--directory /home/runner/work/feq-parse \
--exclude '*/test/*' \
--output-file /home/runner/work/lcov.info
- name: codecov
if: ${{ matrix.build_type == 'coverage' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: /home/runner/work/lcov.info
flags: ctests
- name: Run memory checks with Valgrind (only Linux and GNU compilers)
if: ${{ matrix.memcheck }}
run: |
sudo apt-get install -y valgrind
valgrind --undef-value-errors=no --error-exitcode=1 -s ./build/test/testsuite -A