-
Notifications
You must be signed in to change notification settings - Fork 9
137 lines (115 loc) · 3.6 KB
/
test.yml
File metadata and controls
137 lines (115 loc) · 3.6 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
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
name: CI
on:
push:
branches:
- master
- main
paths-ignore:
- "docs/**"
- "*.md"
- "*.rst"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
- "*.rst"
workflow_dispatch:
env:
M_BUILD_DIR: _build_meson
C_BUILD_DIR: _build_cmake
PIP_PACKAGES: >-
meson>=0.45
ninja
cmake
gcovr
jobs:
gcc-build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
gcc_v: [9, 10, 11, 12]
sanitizer: [none, asan, msan, tsan]
buildtype: [debug]
include:
- os: ubuntu-22.04
gcc_v: 12
sanitizer: none
buildtype: release
runs-on: ${{ matrix.os }}
permissions:
contents: read
env:
FC: gfortran
CC: gcc
GCC_V: ${{ matrix.gcc_v }}
OMP_NUM_THREADS: 2,1
PYTHON_V: 3.8
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_V }}
- name: Install GCC ${{ matrix.GCC_V }} (OSX)
if: contains(matrix.os, 'macos')
run: |
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
ln -s /usr/local/bin/gcc-${GCC_V} /usr/local/bin/gcc
ln -s /usr/local/bin/g++-${GCC_V} /usr/local/bin/g++
env:
GCC_V: ${{ env.GCC_V }}
- name: Install GCC (Linux)
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-${GCC_V} g++-${GCC_V} gfortran-${GCC_V}
env:
GCC_V: ${{ env.GCC_V }}
- name: Set GCC Version (Linux)
if: contains(matrix.os, 'ubuntu')
run: >-
sudo update-alternatives
--install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V}
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
env:
GCC_V: ${{ env.GCC_V }}
- name: Install CBLAS and LAPACKE
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get install libopenblas-dev liblapacke liblapacke-dev libatlas-base-dev
- name: Install meson and test dependencies
run: pip3 install ${{ env.PIP_PACKAGES }}
- name: Configure build
run: >-
meson setup ${{ env.M_BUILD_DIR }}
--buildtype=${{ matrix.buildtype }}
--prefix=$PWD/_dist
--libdir=lib
--warnlevel=0
-Dsanitizer=${{ matrix.sanitizer }}
-Db_coverage=${COVERAGE}
env:
COVERAGE: ${{ contains(matrix.os, 'ubuntu') && 'true' || 'false' }}
- name: Build library
run: meson compile -C ${{ env.M_BUILD_DIR }}
- name: Run unit tests
run: |
meson test -C ${{ env.M_BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2
- name: Create coverage report
if: matrix.os == 'ubuntu-latest' && matrix.GCC_V == '12'
run: |
ninja -C ${{ env.M_BUILD_DIR }} coverage
- name: Install project
run: |
meson install -C ${{ env.M_BUILD_DIR }} --no-rebuild
echo "DFTD4_PREFIX=$PWD/_dist" >> $GITHUB_ENV
- name: Upload coverage to Codecov
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # 5.1.1
if: matrix.os == 'ubuntu-latest' && matrix.GCC_V == '12'
with:
files: ./coverage.xml # optional
verbose: true # optional (default = false)