From 72b85b81dcec498722cf34754d7f070a7d65a646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Aradi?= Date: Fri, 27 Sep 2024 00:54:09 +0200 Subject: [PATCH] Add CI-testing for fpm --- .github/workflows/ci.yml | 11 +++++++---- devel/fpm-export/fpm-export.sh | 19 +++++++++++++++++++ devel/fpm-export/mpi/fpm.toml | 14 ++++++++++++++ devel/fpm-export/mpi/rsync.ignore | 5 +++++ devel/fpm-export/mpi/rsync.include | 14 ++++++++++++++ fpm.toml => devel/fpm-export/serial/fpm.toml | 12 ------------ devel/fpm-export/serial/rsync.ignore | 5 +++++ devel/fpm-export/serial/rsync.include | 14 ++++++++++++++ test/export/mpi/app/testapp.f90 | 6 +++--- test/export/mpi/app/testapp_fypp.fypp | 6 +++--- test/export/mpi/fpm.toml | 2 +- test/export/serial/app/testapp.f90 | 6 +++--- test/export/serial/fpm.toml | 2 +- 13 files changed, 89 insertions(+), 27 deletions(-) create mode 100755 devel/fpm-export/fpm-export.sh create mode 100644 devel/fpm-export/mpi/fpm.toml create mode 100644 devel/fpm-export/mpi/rsync.ignore create mode 100644 devel/fpm-export/mpi/rsync.include rename fpm.toml => devel/fpm-export/serial/fpm.toml (63%) create mode 100644 devel/fpm-export/serial/rsync.ignore create mode 100644 devel/fpm-export/serial/rsync.include diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2868ba2..8e23755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: env: BUILD_DIR: _build INSTALL_DIR: _install + FPM_EXPORT_DIR: _fpm_export jobs: @@ -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 -C ${FPM_EXPORT_DIR}/test/export/${INTERFACE} run testapp + rm -rf ${FPM_EXPORT_DIR} - name: Test Meson pkgconfig export # Meson only detects OpenMPI reliably (as of version 1.3.2) diff --git a/devel/fpm-export/fpm-export.sh b/devel/fpm-export/fpm-export.sh new file mode 100755 index 0000000..1de0906 --- /dev/null +++ b/devel/fpm-export/fpm-export.sh @@ -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=${configdir}/rsync.ignore \ + --include-from=${configdir}/rsync.include \ + --exclude='*' \ + ${SCRIPT_DIR}/../../ ${destdir} +cp ${configdir}/fpm.toml ${destdir} \ No newline at end of file diff --git a/devel/fpm-export/mpi/fpm.toml b/devel/fpm-export/mpi/fpm.toml new file mode 100644 index 0000000..6cdc12d --- /dev/null +++ b/devel/fpm-export/mpi/fpm.toml @@ -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" + diff --git a/devel/fpm-export/mpi/rsync.ignore b/devel/fpm-export/mpi/rsync.ignore new file mode 100644 index 0000000..d4d112c --- /dev/null +++ b/devel/fpm-export/mpi/rsync.ignore @@ -0,0 +1,5 @@ +*~ +*.mod +*.a +*.o + diff --git a/devel/fpm-export/mpi/rsync.include b/devel/fpm-export/mpi/rsync.include new file mode 100644 index 0000000..93646e8 --- /dev/null +++ b/devel/fpm-export/mpi/rsync.include @@ -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/** + diff --git a/fpm.toml b/devel/fpm-export/serial/fpm.toml similarity index 63% rename from fpm.toml rename to devel/fpm-export/serial/fpm.toml index c092d7a..6b22a17 100644 --- a/fpm.toml +++ b/devel/fpm-export/serial/fpm.toml @@ -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" diff --git a/devel/fpm-export/serial/rsync.ignore b/devel/fpm-export/serial/rsync.ignore new file mode 100644 index 0000000..d4d112c --- /dev/null +++ b/devel/fpm-export/serial/rsync.ignore @@ -0,0 +1,5 @@ +*~ +*.mod +*.a +*.o + diff --git a/devel/fpm-export/serial/rsync.include b/devel/fpm-export/serial/rsync.include new file mode 100644 index 0000000..51a4429 --- /dev/null +++ b/devel/fpm-export/serial/rsync.include @@ -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/** + diff --git a/test/export/mpi/app/testapp.f90 b/test/export/mpi/app/testapp.f90 index b9ffc1e..1f3b7eb 100644 --- a/test/export/mpi/app/testapp.f90 +++ b/test/export/mpi/app/testapp.f90 @@ -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 @@ -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()) diff --git a/test/export/mpi/app/testapp_fypp.fypp b/test/export/mpi/app/testapp_fypp.fypp index d31d4e8..7e5819b 100644 --- a/test/export/mpi/app/testapp_fypp.fypp +++ b/test/export/mpi/app/testapp_fypp.fypp @@ -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() @@ -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()) diff --git a/test/export/mpi/fpm.toml b/test/export/mpi/fpm.toml index 00da589..9a822db 100644 --- a/test/export/mpi/fpm.toml +++ b/test/export/mpi/fpm.toml @@ -20,7 +20,7 @@ implicit-external = true source-form = "free" [dependencies] -fortuno-mpi = { path = "../../" } +fortuno-mpi = { path = "../../../" } mpi = "*" [[executable]] diff --git a/test/export/serial/app/testapp.f90 b/test/export/serial/app/testapp.f90 index 8b2aa0c..c1dcd4a 100644 --- a/test/export/serial/app/testapp.f90 +++ b/test/export/serial/app/testapp.f90 @@ -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 @@ -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 diff --git a/test/export/serial/fpm.toml b/test/export/serial/fpm.toml index 5836eef..c8fa96a 100644 --- a/test/export/serial/fpm.toml +++ b/test/export/serial/fpm.toml @@ -20,7 +20,7 @@ implicit-external = false source-form = "free" [dependencies] -fortuno = { path = "../../" } +fortuno = { path = "../../../" } [[executable]] name = "testapp"