-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (108 loc) · 3.86 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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-24.04, compiler: gcc, version: 14 }
- { 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:
# We need to keep using v3 on containers.
# See: https://github.com/actions/checkout/issues/1590#issuecomment-2207052044
- name: Checkout the repository
uses: actions/checkout@v3
# 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