-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (196 loc) · 8.98 KB
/
linux.yml
File metadata and controls
219 lines (196 loc) · 8.98 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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: Linux
on:
workflow_dispatch:
push:
branches: [ main ]
paths: [ '**.cpp', '**.hpp*', '**.cmake', '**/CMakeLists.txt' ]
pull_request:
branches: [ main ]
paths: [ '**.cpp', '**.hpp*', '**.cmake', '**/CMakeLists.txt' ]
schedule:
- cron: '0 12 * * 1-5'
jobs:
# TODO(kononovk) Add clang-5.0, clang-6.0, clang-7
# Fucking cppreference liars, clang doesn't support simple variant usage, before clang-8!
# We can only support this when we remove the variant from the Result
# TODO(kononovk) Add clang-15 when it release
# TODO(kononovk) Add other compilers, like Intel C++?
# TODO(kononovk) libstdc++-7-dev, libc++ old version
main:
runs-on: 'ubuntu-${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
os: [ 20.04, 22.04 ]
compiler: [ clang-9, clang-10, clang-11, clang-12, clang-13, clang-14,
gcc-10, gcc-11, gcc-12 ]
isPR:
- ${{ github.event_name == 'pull_request' }}
exclude:
- isPR: true
os: 20.04
compiler: gcc-12
- isPR: false
os: 20.04
compiler: gcc-12
- isPR: true
os: 22.04
compiler: clang-9
- isPR: true
os: 22.04
compiler: clang-10
- isPR: true
os: 22.04
compiler: clang-11
- isPR: true
os: 22.04
compiler: clang-12
- isPR: true
os: 22.04
compiler: clang-13
- isPR: true
os: 22.04
compiler: clang-14
- isPR: true
os: 22.04
compiler: gcc-10
- isPR: true
os: 22.04
compiler: gcc-11
- isPR: true
os: 22.04
compiler: gcc-12
- isPR: false
os: 22.04
compiler: clang-8
- isPR: false
os: 22.04
compiler: clang-9
- isPR: false
os: 22.04
compiler: clang-10
env:
BUILD_TYPE: 'Debug RelWithDebInfo'
steps:
- uses: actions/checkout@v3
- name: Update dependencies
run: |
sudo apt-get update
sudo apt-get install ninja-build googletest libunwind-dev
- name: Install dependencies clang
if: 1 && !startsWith(matrix.compiler, 'gcc')
run: |
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
if [[ ${{ matrix.os }} == "18.04" ]]; then
ubuntu="bionic"
gcc_version=7
llvm_version=9
elif [[ ${{ matrix.os }} == "20.04" ]]; then
ubuntu="focal"
gcc_version=7
llvm_version=9
else
ubuntu="jammy"
gcc_version=9
llvm_version=13
fi
compiler=${{ matrix.compiler }}
clang_version=${compiler:6}
if [[ $clang_version -ge $llvm_version ]]; then
sudo add-apt-repository "deb http://apt.llvm.org/$ubuntu/ llvm-toolchain-$ubuntu-${clang_version} main"
fi
sudo apt-get update
sudo apt-get install clang-${clang_version} libc++-${clang_version}-dev libc++abi-${clang_version}-dev \
gcc-${gcc_version} g++-${gcc_version} libstdc++-${gcc_version}-dev
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${gcc_version} 200 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${gcc_version} \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-${gcc_version} \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-${gcc_version} \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-${gcc_version} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${gcc_version} \
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-${gcc_version} \
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-${gcc_version}
sudo update-alternatives --auto gcc
sudo update-alternatives \
--install /usr/bin/cpp cpp /usr/bin/cpp-${gcc_version} 200
sudo update-alternatives --auto cpp
- name: Install dependencies gcc
if: startsWith(matrix.compiler, 'gcc')
run: |
compiler=${{ matrix.compiler }}
version=${compiler:4}
sudo apt-get install gcc-$version g++-$version libstdc++-$version-dev
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-$version 200 \
--slave /usr/bin/g++ g++ /usr/bin/g++-$version \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-$version \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-$version \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-$version \
--slave /usr/bin/gcov gcov /usr/bin/gcov-$version \
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-$version \
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-$version
sudo update-alternatives --auto gcc
sudo update-alternatives \
--install /usr/bin/cpp cpp /usr/bin/cpp-$version 200
sudo update-alternatives --auto cpp
- name: Configure CMake
run: |
compiler=${{ matrix.compiler }}
if [[ "$compiler" == gcc* ]]; then
version=${compiler:4}
c_compiler="gcc"
compiler="g++"
else
version=${compiler:6}
c_compiler="clang-$version"
compiler="clang++-$version"
fi
stdlib_names=(libcxx libstdcxx)
link_options=(
"-stdlib=libc++;-lc++abi"
"-stdlib=libstdc++"
)
compile_options=(
"-stdlib=libc++"
"-stdlib=libstdc++"
)
for (( j=0; j<${#stdlib_names[*]}; j+=1 )); do
for build_type in ${BUILD_TYPE[*]}; do
link_option=""; compile_option=""
if [[ "$compiler" == "g++" ]]; then
if [[ "${stdlib_names[$j]}" != "libstdcxx" ]]; then
continue # TODO(kononovk) I dunno how to get GNU GCC to work with other stdlibs
fi
else
link_option=${link_options[$j]}; compile_option=${compile_options[$j]}
if [[ "${stdlib_names[$j]}" == "libstdcxx" ]]; then
continue;
fi
fi
dir="build_${compiler}_${stdlib_names[$j]}_${build_type}"
echo $dir
cmake -S . -B $dir \
-DCMAKE_BUILD_TYPE="$build_type" \
-DIONE_CXX_STANDARD="20" \
-DIONE_TEST=SINGLE \
-DIONE_FLAGS="$flags" \
-DCMAKE_CXX_COMPILER="$compiler" \
-DCMAKE_C_COMPILER="$c_compiler" \
-G"Ninja" \
-DIONE_LINK_OPTIONS="$link_option" \
-DIONE_COMPILE_OPTIONS="$compile_option"
done
done
- name: Build
run: |
for dir in build*/; do
ninja -C $dir
done
- name: Test
run: |
for dir in build*/; do
cd $dir
ctest --output-on-failure -V
cd ..
done