Skip to content

Implement workaround for GNU compiler #81

Implement workaround for GNU compiler

Implement workaround for GNU compiler #81

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths-ignore: ['LICENSE', 'README.rst']
pull_request:
branches: [main]
paths-ignore: ['LICENSE', 'README.rst']
workflow_dispatch:
env:
BUILD_DIR: _build
INSTALL_DIR: _install
jobs:
#
# Test project in various system configurations
#
fortuno-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
compilers: [Intel, GNU]
steps:
- name: Check-out code
uses: actions/checkout@v3
- name: Setup Intel compiler
if: ${{ contains(matrix.compilers, 'Intel') }}
uses: rscohn2/setup-oneapi@v0
with:
components: ifx
- name: Setup Intel environment
if: ${{ contains(matrix.compilers, 'Intel') }}
run: |
/opt/intel/oneapi/setvars.sh
printenv >> ${GITHUB_ENV}
echo "FC=ifx" >> ${GITHUB_ENV}
echo "FPM_FC=ifx" >> ${GITHUB_ENV}
- name: Setup GNU compiler
if: ${{ contains(matrix.compilers, 'GNU') }}
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: '12.2'
- name: Setup GNU environment
if: ${{ contains(matrix.compilers, 'GNU') }}
run: |
echo "FC=gfortran" >> ${GITHUB_ENV}
echo "FPM_FC=gfortran" >> ${GITHUB_ENV}
- name: Setup build tools
run: |
pip install cmake fpm meson ninja
- name: Build Fortuno
run: |
cmake -B ${BUILD_DIR} -G Ninja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
cmake --build ${BUILD_DIR}
cmake --install ${BUILD_DIR}
rm -rf ${BUILD_DIR}
- name: Test CMake export
run: |
CMAKE_PREFIX_PATH=${INSTALL_DIR} cmake -B ${BUILD_DIR} -G Ninja test/export
cmake --build ${BUILD_DIR}
${BUILD_DIR}/testapp
rm -rf ${BUILD_DIR}
- name: Test PkgConfig export
run: |
export LD_LIBRARY_PATH="${PWD}/${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}"
export PKG_CONFIG_PATH="${PWD}/${INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
cflags="$(pkg-config --cflags fortuno)"
lflags="$(pkg-config --libs fortuno)"
mkdir ${BUILD_DIR}
pushd ${BUILD_DIR}
${FC} ${cflags} ${lflags} -o testapp ../test/export/app/testapp.f90
./testapp
popd
rm -rf ${BUILD_DIR}
- name: Test fpm export
run: |
cd test/export
fpm run testapp
- name: Test meson PkgConfig export
run: |
export PKG_CONFIG_PATH="${PWD}/${INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
cd test/export
meson setup -Dfortuno_subproject=false ${BUILD_DIR}
ninja -C ${BUILD_DIR}
${BUILD_DIR}/testapp
rm -rf ./${BUILD_DIR}
- name: Test meson subproject export
run: |
FORTUNO_DIR=${PWD}
GIT_REV=$(git rev-parse HEAD)
cd test/export
mkdir subprojects
echo -e "[wrap-git]\ndirectory=fortuno\n" > subprojects/fortuno.wrap
echo -e "url=file://${FORTUNO_DIR}\nrevision=${GIT_REV}\n" >> subprojects/fortuno.wrap
meson setup -Dfortuno_subproject=true ${BUILD_DIR}
ninja -C ${BUILD_DIR}
${BUILD_DIR}/testapp
rm -rf subprojects ${BUILD_DIR}