Skip to content

Merge pull request #17 from FluidNumerics/funding #65

Merge pull request #17 from FluidNumerics/funding

Merge pull request #17 from FluidNumerics/funding #65

Workflow file for this run

name: ci
on:
push:
branches:
- master
- main
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
pull_request:
paths-ignore:
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
env:
# Modify this variable to change the ifort compiler version - do NOT hardcode the version
# anywhere else!
INTEL_ONEAPI_VERSION: 2023.2.1
jobs:
test:
timeout-minutes: 5
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: coverage
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: debug
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash
build_type: debug
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash
build_type: debug
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash
build_type: debug
- os: ubuntu-22.04
os_name: linux
fcompiler: ifx
ccompiler: icx-cc
shell: bash
build_type: debug
- os: ubuntu-22.04
os_name: linux
fcompiler: ifort
ccompiler: icx-cc
shell: bash
build_type: debug
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-9
ccompiler: gcc-9
shell: bash
build_type: fpm
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-10
ccompiler: gcc-10
shell: bash
build_type: fpm
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-11
ccompiler: gcc-11
shell: bash
build_type: fpm
- os: ubuntu-22.04
os_name: linux
fcompiler: gfortran-12
ccompiler: gcc-12
shell: bash
build_type: fpm
# - os: ubuntu-22.04
# os_name: linux
# fcompiler: ifx
# ccompiler: icx-cc
# shell: bash
# build_type: fpm
- os: ubuntu-22.04
os_name: linux
fcompiler: ifort
ccompiler: icx-cc
shell: bash
build_type: fpm
# Windows
- os: windows-latest
os_name: windows
fcompiler: gfortran
ccompiler: gcc
shell: 'msys2 {0}'
test_type: debug
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
update: true
install: git base-devel mingw-w64-x86_64-toolchain cmake
# - uses: actions/cache@v3
# id: cache
# with:
# path: /opt/intel/oneapi
# key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }}
- name: Install Intel oneAPI Fortran compiler
if: ${{ startsWith(matrix.fcompiler,'if') }}
run: |
# download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# update package index and install Fortran compiler
sudo apt update -y
sudo apt-get -y install intel-oneapi-compiler-fortran-$INTEL_ONEAPI_VERSION intel-oneapi-dpcpp-cpp-$INTEL_ONEAPI_VERSION
# set environment variables and make them persistent across steps
. /opt/intel/oneapi/setvars.sh
env | grep oneapi >> $GITHUB_ENV
- name: Use existing Intel oneAPI Fortran compiler
if: ${{ startsWith(matrix.fcompiler,'if') }}
run: |
# set environment variables and make them persistent across steps
. /opt/intel/oneapi/setvars.sh
env | grep oneapi >> $GITHUB_ENV
- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: Build with Cmake
if: ${{ matrix.build_type != 'fpm' }}
run: |
mkdir build
cd build
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../
make VERBOSE=1
- name: fpm tests
if: ${{ matrix.build_type == 'fpm' }}
run: |
wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64
chmod +x ./fpm-0.9.0-linux-x86_64 && mv ./fpm-0.9.0-linux-x86_64 fpm
./fpm install --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
./fpm test --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }}
./fpm run --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --example "*"
- name: Initialize coverage counters
if: ${{ matrix.build_type == 'coverage' }}
run: |
sudo apt-get update -y && sudo apt-get install lcov
lcov --no-external \
--directory /home/runner/work/feq-parse \
--zerocounters
- name: Run ctests
if: ${{ matrix.build_type != 'fpm' }}
run: |
cd build/test
ctest || ctest --rerun-failed --output-on-failure
- name: Create coverage report
if: ${{ matrix.build_type == 'coverage' }}
run: |
lcov --no-external \
--capture \
--directory /home/runner/work/feq-parse \
--exclude '*/test/*' \
--output-file /home/runner/work/lcov.info
- name: codecov
if: ${{ matrix.build_type == 'coverage' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: /home/runner/work/lcov.info
flags: ctests
- name: Run memory checks with Valgrind (only Linux)
if: ${{ matrix.os_name == 'linux' && matrix.test_type == 'debug' }}
run: |
sudo apt-get install -y valgrind
valgrind --error-exitcode=1 -s ./build/test/testsuite -A