Skip to content

Commit

Permalink
Add CI-testing for fpm
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Sep 26, 2024
1 parent e59b773 commit e1515ea
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 27 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
env:
BUILD_DIR: _build
INSTALL_DIR: _install
FPM_EXPORT_DIR: _fpm_export

jobs:

Expand Down Expand Up @@ -127,10 +128,12 @@ jobs:
${BUILD_DIR}/app/testapp_fypp
rm -rf ${BUILD_DIR}
# - name: Test fpm export
# run: |
# cd test/export
# fpm run testapp
- name: Test fpm export
run: |
./devel/fpm-export/fpm-export.sh ${INTERFACE} ${FPM_EXPORT_DIR}
cd ${FPM_EXPORT_DIR}/test/export/${INTERFACE}
fpm run -C ${FPM_EXPORT_DIR}/test/export/${INTERFACE} testapp
rm -rf ${FPM_EXPORT_DIR}
- name: Test Meson pkgconfig export
# Meson only detects OpenMPI reliably (as of version 1.3.2)
Expand Down
19 changes: 19 additions & 0 deletions devel/fpm-export/fpm-export.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

SCRIPT_DIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"

configdir=$1
destdir=$2

if [[ $# != 2 ]]; then
echo "Need two arguments." >&2
exit 1
fi

rsync \
-av \
--exclude-from=${SCRIPT_DIR}/${configdir}/rsync.ignore \
--include-from=${SCRIPT_DIR}/${configdir}/rsync.include \
--exclude='*' \
${SCRIPT_DIR}/../../ ${destdir}
cp ${SCRIPT_DIR}/${configdir}/fpm.toml ${destdir}
14 changes: 14 additions & 0 deletions devel/fpm-export/mpi/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name = "fortuno-mpi"
version = "0.1.0"
license = "BSD-2-Clause-Patent"
author = "Fortuno authors"
maintainer = "aradi@uni-bremen.de"
copyright = "Copyright 2024, Fortuno authors"

[fortran]
# Enabling the implicit options seems to be necessary for using fpm with meta-dependency mpi.
# Do not worry, the project does not make use of them. ;-)
implicit-typing = true
implicit-external = true
source-form = "free"

5 changes: 5 additions & 0 deletions devel/fpm-export/mpi/rsync.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*~
*.mod
*.a
*.o

14 changes: 14 additions & 0 deletions devel/fpm-export/mpi/rsync.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fpm.serial.toml
LICENSE
src/
src/fortuno.f90
src/fortuno/
src/fortuno/**
src/fortuno_mpi.f90
src/fortuno_mpi/
src/fortuno_mpi/**
test/
test/export/
test/export/mpi/
test/export/mpi/**

12 changes: 0 additions & 12 deletions fpm.toml → devel/fpm-export/serial/fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@ author = "Fortuno authors"
maintainer = "aradi@uni-bremen.de"
copyright = "Copyright 2024, Fortuno authors"

[build]
auto-executables = false
auto-tests = true
auto-examples = false
module-naming = false

[install]
library = true

[fortran]
implicit-typing = false
implicit-external = false
source-form = "free"

[example]
name = "testapp"
5 changes: 5 additions & 0 deletions devel/fpm-export/serial/rsync.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*~
*.mod
*.a
*.o

14 changes: 14 additions & 0 deletions devel/fpm-export/serial/rsync.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fpm.serial.toml
LICENSE
src/
src/fortuno.f90
src/fortuno/
src/fortuno/**
src/fortuno_serial.f90
src/fortuno_serial/
src/fortuno_serial/**
test/
test/export/
test/export/serial/
test/export/serial/**

6 changes: 3 additions & 3 deletions test/export/mpi/app/testapp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
! SPDX-License-Identifier: BSD-2-Clause-Patent

!> Unit tests
module testapp_tests
module testapp_mpi_tests
use mpi_f08, only : mpi_bcast, MPI_INTEGER
use fortuno_mpi, only : global_comm, is_equal, test => mpi_case_item, check => mpi_check,&
& test_list, this_rank
Expand Down Expand Up @@ -32,13 +32,13 @@ function tests()

end function tests

end module testapp_tests
end module testapp_mpi_tests


!> Test app driving Fortuno unit tests
program testapp
use fortuno_mpi, only : execute_mpi_cmd_app
use testapp_tests, only : tests
use testapp_mpi_tests, only : tests
implicit none

call execute_mpi_cmd_app(tests())
Expand Down
6 changes: 3 additions & 3 deletions test/export/mpi/app/testapp_fypp.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#:include "fortuno_mpi.fypp"

!> Unit tests
module testapp_fypp_tests
module testapp_mpi_fypp_tests
use mpi_f08, only : mpi_bcast, MPI_INTEGER
use fortuno_mpi, only : global_comm, is_equal, test_list, this_rank
$:FORTUNO_MPI_IMPORTS()
Expand Down Expand Up @@ -36,13 +36,13 @@ contains

end function tests

end module testapp_fypp_tests
end module testapp_mpi_fypp_tests


!> Test app driving Fortuno unit tests
program testapp
use fortuno_mpi, only : execute_mpi_cmd_app
use testapp_fypp_tests, only : tests
use testapp_mpi_fypp_tests, only : tests
implicit none

call execute_mpi_cmd_app(tests())
Expand Down
2 changes: 1 addition & 1 deletion test/export/mpi/fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ implicit-external = true
source-form = "free"

[dependencies]
fortuno-mpi = { path = "../../" }
fortuno-mpi = { path = "../../../" }
mpi = "*"

[[executable]]
Expand Down
6 changes: 3 additions & 3 deletions test/export/serial/app/testapp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
! SPDX-License-Identifier: BSD-2-Clause-Patent

!> Unit tests
module testapp_tests
module testapp_serial_tests
use fortuno_serial, only : is_equal, test => serial_case_item, check => serial_check, test_list
implicit none

Expand All @@ -27,12 +27,12 @@ function tests()

end function tests

end module testapp_tests
end module testapp_serial_tests


!> Test app driving Fortuno unit tests
program testapp
use testapp_tests, only : tests
use testapp_serial_tests, only : tests
use fortuno_serial, only : execute_serial_cmd_app
implicit none

Expand Down
2 changes: 1 addition & 1 deletion test/export/serial/fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ implicit-external = false
source-form = "free"

[dependencies]
fortuno = { path = "../../" }
fortuno = { path = "../../../" }

[[executable]]
name = "testapp"
Expand Down

0 comments on commit e1515ea

Please sign in to comment.