Repository navigation
110 lines (95 loc) · 3.25 KB
/
Copy pathtest.yml
File metadata and controls
110 lines (95 loc) · 3.25 KB
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
name: Test
on:
pull_request:
push:
schedule:
- cron: '0 0 1 * *' # monthly
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- { 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@v7
- 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@v11
with:
fpm-version: v0.11.0
- 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@v7
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# For old compilers.
test-on-container:
strategy:
fail-fast: false
matrix:
include:
- { image: 'gcc:4.9' }
- { image: 'gcc:5' }
- { image: 'gcc:6' }
- { image: 'gcc:7' }
- { image: 'gcc:8' }
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v7
# We have to manually start a container. Otherwise, GitHub-provided actions
# don't work properly in older OS containers.
# See: https://github.com/actions/checkout/issues/1590#issuecomment-2567109195
- name: Start Docker container
run: |
docker pull ${{ matrix.image }}
docker run --name build-container -d -v ${{ github.workspace }}:/workspace ${{ matrix.image }} tail -f /dev/null
- name: Install Dependencies
env:
SCRIPT: |
curl -L -O https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0-linux-x86_64-gcc-12
mv fpm-*-linux-x86_64* fpm
chmod +x fpm
mv fpm /usr/local/bin
run: docker exec build-container bash -c "$SCRIPT"
- name: Print compiler version
env:
SCRIPT: |
gfortran --version
run: docker exec build-container bash -c "$SCRIPT"
- name: Run test
env:
SCRIPT: |
cd /workspace
fpm test
run: docker exec build-container bash -c "$SCRIPT"