-
-
Notifications
You must be signed in to change notification settings - Fork 3
189 lines (185 loc) · 5.92 KB
/
build-linux.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Build Linux
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-linux:
name: '${{ matrix.os.id }} (${{ matrix.compiler }})'
runs-on: ${{ matrix.os.id }}
strategy:
matrix:
os:
- { id: ubuntu-22.04, name: jammy }
compiler:
- 'clang-13'
- 'clang-14'
- 'clang-15'
- 'gcc-10'
- 'gcc-11'
fail-fast: false
steps:
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
- name: Setup GCC
if: startsWith(matrix.compiler, 'gcc')
shell: bash
run: |
CXX=${CC/#gcc/g++}
sudo apt-add-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install $CC $CXX
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
- name: Setup Clang
if: startsWith(matrix.compiler, 'clang')
shell: bash
run: |
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
rm llvm-snapshot.gpg.key
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }}${CC/#clang/} main"
sudo apt-get update
CXX=${CC/#clang/clang++}
sudo apt-get install $CC $CXX
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
working-directory: ${{ runner.temp }}
- name: Checkout
uses: actions/checkout@v3
- name: Setup Meson + Ninja
shell: bash
run: |
sudo python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --user meson ninja
working-directory: ${{ runner.temp }}
- name: Version tools
shell: bash
run: |
$CC --version
$CXX --version
meson --version
ninja --version
- name: Configure
run: meson build --prefix=$HOME/.local
- name: Build
run: ninja -C build
- name: Test
run: ninja -C build test
- name: Install
run: ninja -C build install
build-coverage-linux:
if: github.repository == 'mangrove-lang/mangrove'
name: 'coverage ${{ matrix.os.id }} (${{ matrix.compiler }})'
runs-on: ${{ matrix.os.id }}
strategy:
matrix:
os:
- { id: ubuntu-22.04, name: jammy }
compiler:
- 'clang-13'
- 'clang-14'
- 'clang-15'
- 'gcc-10'
- 'gcc-11'
fail-fast: false
steps:
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
- name: Coverage environment
run: |
echo "BUILD_OPTS=-Db_coverage=true -Db_lto=false --buildtype=debug" >> $GITHUB_ENV
- name: Setup GCC
if: startsWith(matrix.compiler, 'gcc')
shell: bash
run: |
CXX=${CC/#gcc/g++}
sudo apt-add-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install $CC $CXX gcovr
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "GCOV=${CC/#gcc/gcov}" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
- name: Setup Clang
if: startsWith(matrix.compiler, 'clang')
shell: bash
run: |
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
rm llvm-snapshot.gpg.key
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }}${CC/#clang/} main"
sudo apt-get update
CXX=${CC/#clang/clang++}
sudo apt-get install $CC $CXX gcovr
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "GCOV=/usr/lib/${CC/#clang/llvm}/bin/llvm-cov gcov" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
working-directory: ${{ runner.temp }}
- name: Add coverage dependency
if: matrix.compiler == 'clang-14'
shell: bash
run: |
apt download libclang-rt-14-dev
PACKAGE=$(find . -name 'libclang-rt-14*.deb')
sudo dpkg --install --force-breaks $PACKAGE
working-directory: ${{ runner.temp }}
- name: Checkout
uses: actions/checkout@v3
- name: Setup Meson + Ninja
shell: bash
run: |
sudo python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --user meson ninja
working-directory: ${{ runner.temp }}
- name: Version tools
shell: bash
run: |
$CC --version
$CXX --version
$GCOV --version
meson --version
ninja --version
- name: Configure
run: meson build --prefix=$HOME/.local $BUILD_OPTS
- name: Build
run: ninja -C build
- name: Test
run: ninja -C build test
# Codecov no longer parses gcov files automatically
- name: Prepare coverage files
shell: bash
run: |
cd build
find . -type f -name '*.gcda' -exec $GCOV -p {} + > /dev/null
- name: Coverage prep
if: success()
run: gcovr -r .. -x coverage.xml --gcov-executable "$GCOV" -e ../deps -e ../test
working-directory: build
- name: Codecov
if: success()
uses: codecov/codecov-action@v3