Skip to content

ci: try

ci: try #183

Workflow file for this run

name: Test
on:
pull_request:
push:
schedule:
- cron: '0 0 1 * *' # monthly
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, compiler: gcc, version: 7 }
- { os: ubuntu-20.04, compiler: gcc, version: 8 }
- { os: ubuntu-22.04, compiler: gcc, version: 9 }
- { os: ubuntu-22.04, compiler: gcc, version: 10 }
- { os: ubuntu-22.04, compiler: gcc, version: 11, build-type: coverage }
- { os: ubuntu-22.04, compiler: gcc, version: 12 }
- { os: ubuntu-22.04, compiler: gcc, version: 13 }
- { os: ubuntu-22.04, compiler: intel, version: '2023.2' }
- { os: ubuntu-22.04, compiler: intel-classic, version: '2021.9' }
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Fortran
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Set up fpm
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: v0.10.1
- name: Print compiler version
run: $FC --version
- name: Run test
if: matrix.build-type != 'coverage'
run: fpm test
- name: Run test (with coverage)
if: matrix.build-type == 'coverage'
run: fpm test
env:
FPM_FFLAGS: -coverage -g -fcheck=bounds -fcheck=array-temps -fbacktrace
- name: Run gcov
if: matrix.build-type == 'coverage'
run: find . -type f -name '*.gcno' -exec gcov -pb {} +
- name: Upload coverage report
if: matrix.build-type == 'coverage'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# For old compilers.
test-on-container:
strategy:
fail-fast: false
matrix:
include:
- { image: 'ubuntu:16.04', compiler: gcc, version: 4.9 }
- { image: 'ubuntu:18.04', compiler: gcc, version: 5 }
- { image: 'ubuntu:18.04', compiler: gcc, version: 6 }
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
# Composite actions should be manually mounted.
# See: https://github.com/orgs/community/discussions/53771
volumes:
- /home/runner/work/_actions/fortran-lang/setup-fortran/v1:/home/runner/work/_actions/fortran-lang/setup-fortran/v1
# Workaround for checkout@v3 on containers.
# See: https://github.com/actions/checkout/issues/1590#issuecomment-2207052044
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout the repository
uses: actions/checkout@v4
# fortran-lang/setup-fortran requires sudo on Ubuntu.
- name: Create a dummy sudo
run: |
mkdir -p bin
echo '#!/bin/sh' >bin/sudo
echo '"$@"' >>bin/sudo
chmod +x bin/sudo
echo "$(cd bin && pwd)" >>$GITHUB_PATH
# fortran-lang/setup-fortran requires add-apt-repository and fpm requires git.
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git software-properties-common
- name: Set up Fortran
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Set up fpm
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: v0.10.1
- name: Print compiler version
run: $FC --version
- name: Run test
run: fpm test