-
Notifications
You must be signed in to change notification settings - Fork 21
165 lines (137 loc) · 4.23 KB
/
build.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: CI
on: [push, pull_request]
env:
BUILD_DIR: _build
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
build: [meson, cmake]
build-type: [debug]
compiler: [gcc]
version: [10]
include:
- os: ubuntu-latest
build: fpm
build-type: debug
compiler: gcc
version: 10
- os: ubuntu-latest
build: meson
build-type: coverage
compiler: gcc
version: 10
- os: macos-latest
build: meson
build-type: coverage
compiler: gcc
version: 10
- os: ubuntu-latest
build: meson
build-type: debug
compiler: gcc
version: 9
- os: ubuntu-latest
build: meson
build-type: debug
compiler: gcc
version: 11
- os: ubuntu-latest
build: meson
build-type: debug
compiler: intel-classic
version: 2021.6
- os: macos-latest
build: meson
build-type: debug
compiler: intel-classic
version: 2021.6
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
- name: Install python dependencies
if: ${{ ! contains(matrix.os, 'windows') }}
run: pip install -r requirements.txt
- name: Setup fortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Setup fpm
if: ${{ matrix.build == 'fpm' }}
uses: fortran-lang/setup-fpm@v3
with:
fpm-version: 'v0.2.0'
- name: Configure build (meson)
if: ${{ matrix.build == 'meson' }}
run: >-
meson setup ${{ env.BUILD_DIR }}
--buildtype=debug
--prefix=$PWD/_dist
--libdir=lib
--warnlevel=0
-Db_coverage=${{ env.COVERAGE }}
${{ env.MESON_ARGS }}
env:
COVERAGE: ${{ matrix.build-type == 'coverage' }}
MESON_ARGS: ${{ matrix.compiler == 'intel-classic' && '-Dfortran_link_args=-qopenmp' || '' }}
- name: Configure build (CMake)
if: ${{ matrix.build == 'cmake' }}
run: >-
cmake -B${{ env.BUILD_DIR }}
-GNinja
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DCMAKE_INSTALL_LIBDIR=lib
- name: Build library (fpm)
if: ${{ matrix.build == 'fpm' }}
run: fpm build
- name: Build library
if: ${{ matrix.build != 'fpm' }}
run: ninja -C ${{ env.BUILD_DIR }}
- name: Run unit tests (fpm)
if: ${{ matrix.build == 'fpm' }}
run: fpm test
- name: Run unit tests (meson)
if: ${{ matrix.build == 'meson' }}
run: meson test -C ${{ env.BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2
- name: Run unit tests (ctest)
if: ${{ matrix.build == 'cmake' }}
run: ctest --output-on-failure --parallel 2
working-directory: ${{ env.BUILD_DIR }}
- name: Create coverage report
if: ${{ matrix.build == 'meson' && matrix.build-type == 'coverage' }}
run: ninja -C ${{ env.BUILD_DIR }} coverage
- name: Install project
if: ${{ matrix.build != 'fpm' }}
run: |
ninja -C ${{ env.BUILD_DIR }} install
echo "PROJECT_PREFIX=$PWD/_dist" >> $GITHUB_ENV
- name: Create package
if: ${{ matrix.build == 'meson' }}
run: |
tar cvf ${{ env.OUTPUT }} _dist
xz -T0 ${{ env.OUTPUT }}
echo "PROJECT_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV
env:
OUTPUT: test-drive-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}.tar
- name: Upload package
if: ${{ matrix.build == 'meson' && matrix.build-type != 'coverage' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_OUTPUT }}
path: ${{ env.PROJECT_OUTPUT }}
- name: Upload coverage report
if: ${{ matrix.build == 'meson' && matrix.build-type == 'coverage' }}
uses: codecov/codecov-action@v3