-
Notifications
You must be signed in to change notification settings - Fork 883
228 lines (216 loc) · 6.96 KB
/
gha.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
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
220
221
222
223
224
225
226
227
228
name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- c_master
tags:
- '*'
jobs:
macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
pattern: [0, 1, 2, 3]
steps:
- uses: actions/checkout@v1
- name: build and test
env:
CC: clang
CXX: clang++
shell: bash
run: |
BASE=`pwd`;
# matrix config
ACTION="ci/build_cmake.sh"
export ARCH="64"
if [ ${{ matrix.pattern }} == 0 ]; then
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="unsigned"
fi
if [ ${{ matrix.pattern }} == 1 ]; then
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="signed"
fi
if [ ${{ matrix.pattern }} == 2 ]; then
export SHARED="OFF"
export CHAR_SIGN="signed"
fi
if [ ${{ matrix.pattern }} == 3 ]; then
export SHARED="OFF"
export CHAR_SIGN="unsigned"
fi
# install gtest
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
unzip -q googletest-release-1.7.0.zip
cd googletest-release-1.7.0
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c
$CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c
ar -rv libgtest.a gtest-all.o
ar -rv libgtest_main.a gtest_main.o
mkdir -p ${BASE}/usr/include
cp -r include/gtest ${BASE}/usr/include
mkdir -p ${BASE}/usr/lib
mv *.a ${BASE}/usr/lib
cd ..
# build and test
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" GTEST_ROOT="${BASE}/usr" CFLAGS="-Werror -g -fsanitize=undefined -fno-sanitize-recover=all" CXXFLAGS="-Werror -g -ggdb3 -fsanitize=undefined -fno-sanitize-recover=all" ${ACTION}
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8]
steps:
- uses: actions/checkout@v1
- name: install build depends
run: |
sudo apt-get update
sudo apt-get install g++-multilib clang valgrind
- name: build and test
shell: bash
run: |
BASE=`pwd`;
# matrix config
if [ ${{ matrix.pattern }} == 0 ]; then
export CC=clang
export CXX=clang++
ACTION="ci/build_cmake.sh"
export ARCH="64"
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="unsigned"
fi
if [ ${{ matrix.pattern }} == 1 ]; then
export CC=clang
export CXX=clang++
ACTION="ci/build_cmake.sh"
export ARCH="32"
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="signed"
fi
if [ ${{ matrix.pattern }} == 2 ]; then
export CC=clang
export CXX=clang++
ACTION="ci/build_cmake.sh"
export ARCH="64"
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="signed"
fi
if [ ${{ matrix.pattern }} == 3 ]; then
export CC=clang
export CXX=clang++
ACTION="ci/build_cmake.sh"
export ARCH="32"
export SHARED="OFF"
export CHAR_SIGN="unsigned"
fi
if [ ${{ matrix.pattern }} == 4 ]; then
export CC=gcc
export CXX=g++
ACTION="ci/build_cmake.sh"
export ARCH="64"
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="signed"
fi
if [ ${{ matrix.pattern }} == 5 ]; then
export CC=gcc
export CXX=g++
ACTION="ci/build_cmake.sh"
export ARCH="32"
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="unsigned"
fi
if [ ${{ matrix.pattern }} == 6 ]; then
export CC=gcc
export CXX=g++
ACTION="ci/build_cmake.sh"
export ARCH="64"
export SHARED="ON"
export SAN="-fsanitize=address -fno-omit-frame-pointer"
export CHAR_SIGN="unsigned"
fi
if [ ${{ matrix.pattern }} == 7 ]; then
export CC=gcc
export CXX=g++
ACTION="ci/build_cmake.sh"
export ARCH="32"
export SHARED="OFF"
export CHAR_SIGN="signed"
fi
if [ ${{ matrix.pattern }} == 8 ]; then
export CC=gcc
export CXX=g++
ACTION="ci/build_cmake_embedded.sh"
export ARCH="64"
fi
# install gtest
wget https://github.com/google/googletest/archive/v1.13.0.zip -O googletest-1.13.0.zip
unzip -q googletest-1.13.0.zip
cd googletest-1.13.0
cmake -S . -DCMAKE_CXX_FLAGS="-m$ARCH" --install-prefix="$BASE/usr"
cmake --build . --verbose
cmake --install . --verbose
cd ..
# install zlib
if [ ${ARCH} == 32 ]; then
sudo apt-get install lib32z1-dev
fi
# build and test
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" GTEST_ROOT="${BASE}/usr" CFLAGS="-Werror -g -gdwarf-4 -fsanitize=undefined -fno-sanitize-recover=all" CXXFLAGS="-Werror -g -ggdb3 -gdwarf-4 -fsanitize=undefined -fno-sanitize-recover=all" ${ACTION}
windows:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
pattern: [0, 1, 2, 3]
steps:
- uses: actions/[email protected]
- name: Cache vcpkg
id: cache-vcpkg
uses: actions/[email protected]
with:
path: C:/vcpkg/installed
key: windows-2019-vcpkg-v2
- name: Build dependencies
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
shell: powershell
run: |
vcpkg install gtest:x64-windows gtest:x86-windows
vcpkg install zlib:x64-windows zlib:x86-windows
- name: Build and test
shell: powershell
run: |
if (${{ matrix.pattern }} -eq 0) {
$ARCH="x64"
$SHARED="ON"
}
elseif (${{ matrix.pattern }} -eq 1) {
$ARCH="x64"
$SHARED="OFF"
}
elseif (${{ matrix.pattern }} -eq 2) {
$ARCH="Win32"
$SHARED="ON"
}
else {
$ARCH="Win32"
$SHARED="OFF"
}
$CUR=(Get-Location).Path
md build
cd build
cmake -A $ARCH -DBUILD_SHARED_LIBS=$SHARED -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_CXX_FLAGS=/D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" ..
cmake --build . --config Release
$pathbak="$env:PATH"
$env:PATH="C:\vcpkg\installed\x64-windows\bin;$CUR\build\Release;$pathbak"
ctest -V
$env:PATH=$pathbak