-
Notifications
You must be signed in to change notification settings - Fork 6
151 lines (134 loc) · 4.05 KB
/
unit.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
name: unit tests
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler: [gfortran-12, gfortran-13]
gcc: [gcc-12, gcc-13]
coverage: [false]
include:
- os: ubuntu-latest
compiler: gfortran-14
gcc: gcc-14
coverage: true
env:
CC: ${{ matrix.gcc }}
FC: ${{ matrix.compiler }}
PFUNIT_DIR: /home/runner/work/legolas/legolas/tests/pFUnit/build/installed
LEGOLASDIR: /home/runner/work/legolas/legolas
ARPACK_ROOT: /home/runner/work/legolas/legolas/tests/arpack-ng
name: unit-tests / ${{ matrix.os }} / ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install cmake
uses: jwlawson/[email protected]
with:
cmake-version: "3.24.x"
- name: Install Legolas dependencies
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.compiler }}
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
sudo apt-get install lcov
${FC} --version
cmake --version
gcov --version
- name: Install Python dependencies & Pylbo
run: |
python -m pip install --upgrade pip
pip install pytest numpy matplotlib f90nml tqdm psutil pytest-mpl scipy
cd post_processing
python setup.py develop
- name: Cache pFUnit
id: pfunit-cache
uses: actions/cache@v1
with:
path: tests/pFUnit/
key: ${{ runner.os }}-${{ matrix.compiler }}-pfunitv1
- name: Build pFUnit
if: steps.pfunit-cache.outputs.cache-hit != 'true'
run: |
cd tests/
git clone https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
cd pFUnit
mkdir build
cd build
cmake .. -DSKIP_MPI=YES -DSKIP_OPENMP=YES -DSKIP_FHAMCREST=YES
make -j 2 tests
make -j 2 install
- name: Cache ARPACK
id: arpack-cache
uses: actions/cache@v1
with:
path: tests/arpack-ng/
key: ${{ runner.os }}-${{ matrix.compiler }}-arpackv1
- name: Build ARPACK
if: steps.arpack-cache.outputs.cache-hit != 'true'
run: |
cd tests
git clone https://github.com/opencollab/arpack-ng.git
cd arpack-ng
mkdir build
mkdir installed
cd build
cmake -DEXAMPLES=OFF -DMPI=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../installed ..
make -j 2
sudo make -j 2 install
- name: Compile Legolas
run: |
mkdir build
cd build
if [[ "${{ matrix.coverage }}" ]]; then
cmake -DCoverage=ON ..
else
cmake -DDebug=ON ..
fi
make -j 2
- name: Run tests
run: |
cd $LEGOLASDIR/tests/unit_tests
mkdir build
cd build
cmake -DCoverage=ON ..
make -j 2
cd ..
# ensure failures are caught, pFUnit sometimes silently fails?
./test_legolas | tee test_legolas.log
if grep -q "FAILURES" test_legolas.log; then
exit 1
fi
- name: Generate coverage report
if: ${{ matrix.coverage }}
run: |
mkdir coverage
cd coverage
lcov --capture --directory $LEGOLASDIR/build \
--output-file unit-tests-${{ matrix.compiler }}.info \
--gcov-tool /usr/bin/gcov-14
# filter out coverage files
find $LEGOLASDIR/build -name '*.gc*' -delete
- name: Archive failed logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: failed_logs
path: tests/regression_tests/test_results
- name: Upload coverage report
uses: codecov/codecov-action@v1
if: ${{ matrix.coverage }}
with:
files: ./coverage/unit-tests-${{ matrix.compiler }}.info
flags: legolas