Skip to content

Commit 712ff06

Browse files
committed
Add GH actions workflow for unit tests with pFUnit
1 parent 5a2c14c commit 712ff06

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/unit_tests.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
11+
- uses: actions/checkout@v2
12+
13+
# We don't want to build openmpi each time this workflow is
14+
# run. Setup caching of OpenMPI after it is built and installed.
15+
# See "Caching dependencies to speed up workflows" on the GH
16+
# actions docs.
17+
- name: Cache OpenMPI
18+
id: cache-openmpi
19+
uses: actions/cache@v2
20+
with:
21+
path: openmpi-4.1.2/installed
22+
key: openmpi-4.1.2
23+
24+
# Same goes for pFUnit
25+
- name: Cache pFUnit
26+
id: cache-pfunit
27+
uses: actions/cache@v2
28+
with:
29+
path: pfunit-4.2.2/installed
30+
key: pfunit-4.2.2
31+
32+
- name: Build openmpi
33+
if: steps.cache-openmpi.outputs.cache-hit != 'true'
34+
run: |
35+
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.2.tar.gz
36+
tar -xf openmpi-4.1.2.tar.gz
37+
cd openmpi-4.1.2/ && mkdir installed
38+
./configure --prefix=$(pwd)/installed
39+
make all install
40+
41+
- name: Build pFUnit
42+
run: |
43+
git clone --depth 1 --branch v4.2.2 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-4.2.2
44+
mkdir pfunit-4.2.2/build && cd pfunit-4.2.2/build
45+
cmake ..
46+
make install
47+
48+
- name: Build the tests
49+
run: |
50+
export PATH=$(pwd)/openmpi-4.1.2/installed/bin/:$PATH
51+
cmake ..
52+
make tests
53+
env:
54+
PFUNIT_DIR: pfunit-4.2.2/build/installed
55+
56+
- name: Run unit tests
57+
run: |
58+
export PATH=$(pwd)/openmpi-4.1.2/installed/bin/:$PATH
59+
export LD_LIBRARY_PATH=$(pwd)/openmpi-4.1.2/installed/lib:$LD_LIBRARY_PATH
60+
mpirun -n 1 build/tests/tests

0 commit comments

Comments
 (0)