-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GH actions workflow for unit tests with pFUnit
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Build | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
# We don't want to build openmpi each time this workflow is | ||
# run. Setup caching of OpenMPI after it is built and installed. | ||
# See "Caching dependencies to speed up workflows" on the GH | ||
# actions docs. | ||
- name: Cache OpenMPI | ||
id: cache-openmpi | ||
uses: actions/cache@v2 | ||
with: | ||
path: openmpi-4.1.2/installed | ||
key: openmpi-4.1.2 | ||
|
||
# Same goes for pFUnit | ||
- name: Cache pFUnit | ||
id: cache-pfunit | ||
uses: actions/cache@v2 | ||
with: | ||
path: pfunit-4.2.2/installed | ||
key: pfunit-4.2.2 | ||
|
||
- name: Build openmpi | ||
if: steps.cache-openmpi.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.2.tar.gz | ||
tar -xf openmpi-4.1.2.tar.gz | ||
cd openmpi-4.1.2/ && mkdir installed | ||
./configure --prefix=$(pwd)/installed | ||
make all install | ||
- name: Build pFUnit | ||
run: | | ||
git clone --depth 1 --branch v4.2.2 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-4.2.2 | ||
mkdir pfunit-4.2.2/build && cd pfunit-4.2.2/build | ||
cmake .. | ||
make install | ||
- name: Build the tests | ||
run: | | ||
export PATH=$(pwd)/openmpi-4.1.2/installed/bin/:$PATH | ||
cmake .. | ||
make tests | ||
env: | ||
PFUNIT_DIR: pfunit-4.2.2/build/installed | ||
|
||
- name: Run unit tests | ||
run: | | ||
export PATH=$(pwd)/openmpi-4.1.2/installed/bin/:$PATH | ||
export LD_LIBRARY_PATH=$(pwd)/openmpi-4.1.2/installed/lib:$LD_LIBRARY_PATH | ||
mpirun -n 1 build/tests/tests |