Skip to content

Commit 9c45623

Browse files
authored
Merge pull request #824 from redboltz/migrate_to_gha
Migrate to gha
2 parents 8085ab8 + 08b0c88 commit 9c45623

File tree

5 files changed

+333
-265
lines changed

5 files changed

+333
-265
lines changed

.github/workflows/gha.yml

Lines changed: 320 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,320 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
push:
7+
branches:
8+
- master
9+
tags:
10+
- '*'
11+
12+
jobs:
13+
macos:
14+
runs-on: macos-latest
15+
strategy:
16+
matrix:
17+
pattern: [0, 1, 2, 3]
18+
steps:
19+
- uses: actions/checkout@v1
20+
- name: install boost
21+
run: |
22+
brew install boost
23+
- name: build and test
24+
env:
25+
CC: clang
26+
CXX: clang++
27+
shell: bash
28+
run: |
29+
BASE=`pwd`;
30+
mkdir ${BASE}/usr;
31+
32+
# matrix config
33+
if [ ${{ matrix.pattern }} == 0 ]; then
34+
ACTION="ci/build_cmake.sh"
35+
export CXX17="ON"
36+
export ARCH="64"
37+
export BOOST="ON"
38+
SHARED="ON"
39+
export CHAR_SIGN="unsigned"
40+
export API_VERSION="1"
41+
fi
42+
if [ ${{ matrix.pattern }} == 1 ]; then
43+
ACTION="ci/build_cmake.sh"
44+
export CXX17="ON"
45+
export ARCH="64"
46+
export BOOST="ON"
47+
export SHARED="ON"
48+
export CHAR_SIGN="signed"
49+
export API_VERSION="3"
50+
fi
51+
if [ ${{ matrix.pattern }} == 2 ]; then
52+
ACTION="ci/build_cmake.sh"
53+
export CXX17="ON"
54+
export ARCH="64"
55+
export SHARED="ON"
56+
export CHAR_SIGN="signed"
57+
export API_VERSION="2"
58+
fi
59+
if [ ${{ matrix.pattern }} == 3 ]; then
60+
ACTION="ci/build_cmake.sh"
61+
export ARCH="64"
62+
export SHARED="ON"
63+
export CHAR_SIGN="unsigned"
64+
export API_VERSION="2"
65+
fi
66+
67+
# install gtest
68+
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
69+
unzip -q googletest-release-1.7.0.zip
70+
cd googletest-release-1.7.0
71+
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c
72+
$CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c
73+
ar -rv libgtest.a gtest-all.o
74+
ar -rv libgtest_main.a gtest_main.o
75+
mkdir -p ${BASE}/usr/include
76+
cp -r include/gtest ${BASE}/usr/include
77+
mkdir -p ${BASE}/usr/lib
78+
mv *.a ${BASE}/usr/lib
79+
cd ..
80+
81+
# build and test
82+
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
83+
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
84+
85+
linux:
86+
runs-on: ubuntu-18.04
87+
strategy:
88+
matrix:
89+
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
90+
steps:
91+
- uses: actions/checkout@v1
92+
- name: install g++-multilib
93+
run: |
94+
sudo apt-get update
95+
sudo apt-get install g++-multilib
96+
- name: install clang
97+
run: |
98+
sudo apt-get update
99+
sudo apt-get install clang-8
100+
- name: install valgrind
101+
run: |
102+
sudo apt-get update
103+
sudo apt-get install valgrind
104+
- name: build and test
105+
shell: bash
106+
run: |
107+
BASE=`pwd`;
108+
mkdir ${BASE}/usr;
109+
110+
# matrix config
111+
if [ ${{ matrix.pattern }} == 0 ]; then
112+
export CC=clang
113+
export CXX=clang++
114+
ACTION="ci/build_cmake.sh"
115+
export ARCH="64"
116+
export BOOST="ON"
117+
export SHARED="ON"
118+
export CHAR_SIGN="unsigned"
119+
export API_VERSION="2"
120+
fi
121+
if [ ${{ matrix.pattern }} == 1 ]; then
122+
export CC=clang
123+
export CXX=clang++
124+
ACTION="ci/build_cmake.sh"
125+
export ARCH="32"
126+
export SHARED="ON"
127+
export CHAR_SIGN="signed"
128+
export API_VERSION="2"
129+
fi
130+
if [ ${{ matrix.pattern }} == 2 ]; then
131+
export CC=clang
132+
export CXX=clang++
133+
ACTION="ci/build_cmake.sh"
134+
export CXX17="ON"
135+
export ARCH="64"
136+
export BOOST="ON"
137+
export SHARED="ON"
138+
export CHAR_SIGN="signed"
139+
export API_VERSION="3"
140+
export X3_PARSE="ON"
141+
fi
142+
if [ ${{ matrix.pattern }} == 3 ]; then
143+
export CC=clang
144+
export CXX=clang++
145+
ACTION="ci/build_cmake.sh"
146+
export CXX17="ON"
147+
export ARCH="32"
148+
export SHARED="OFF"
149+
export CHAR_SIGN="unsigned"
150+
export API_VERSION="2"
151+
fi
152+
if [ ${{ matrix.pattern }} == 4 ]; then
153+
export CC=gcc
154+
export CXX=g++
155+
ACTION="ci/build_cmake.sh"
156+
export CXX17="ON"
157+
export ARCH="64"
158+
export SHARED="ON"
159+
export CHAR_SIGN="signed"
160+
export API_VERSION="2"
161+
fi
162+
if [ ${{ matrix.pattern }} == 5 ]; then
163+
export CC=gcc
164+
export CXX=g++
165+
ACTION="ci/build_cmake.sh"
166+
export CXX17="ON"
167+
export ARCH="32"
168+
export BOOST="ON"
169+
export SHARED="ON"
170+
export CHAR_SIGN="unsigned"
171+
export API_VERSION="3"
172+
export X3_PARSE="ON"
173+
fi
174+
if [ ${{ matrix.pattern }} == 6 ]; then
175+
export CC=gcc
176+
export CXX=g++
177+
ACTION="ci/build_cmake.sh"
178+
export ARCH="64"
179+
export SHARED="ON"
180+
export CHAR_SIGN="unsigned"
181+
export API_VERSION="2"
182+
fi
183+
if [ ${{ matrix.pattern }} == 7 ]; then
184+
export CC=gcc
185+
export CXX=g++
186+
ACTION="ci/build_cmake.sh"
187+
export ARCH="32"
188+
export BOOST="ON"
189+
export SHARED="OFF"
190+
export CHAR_SIGN="signed"
191+
export API_VERSION="1"
192+
fi
193+
if [ ${{ matrix.pattern }} == 8 ]; then
194+
export CC=gcc
195+
export CXX=g++
196+
ACTION="ci/build_cmake.sh"
197+
export ARCH="32"
198+
export BOOST="ON"
199+
export SHARED="OFF"
200+
export CHAR_SIGN="signed"
201+
export API_VERSION="2"
202+
fi
203+
if [ ${{ matrix.pattern }} == 9 ]; then
204+
export CC=clang
205+
export CXX=clang++
206+
ACTION="ci/build_regression.sh"
207+
export ARCH="64"
208+
export SAN="UBSAN"
209+
export MSGPACK_FUZZ_REGRESSION="ON"
210+
export CTEST_OUTPUT_ON_FAILURE=1
211+
fi
212+
if [ ${{ matrix.pattern }} == 10 ]; then
213+
export CC=clang
214+
export CXX=clang++
215+
ACTION="ci/build_regression.sh"
216+
export ARCH="64"
217+
export SAN="ASAN"
218+
export MSGPACK_FUZZ_REGRESSION="ON"
219+
export CTEST_OUTPUT_ON_FAILURE=1
220+
fi
221+
if [ ${{ matrix.pattern }} == 11 ]; then
222+
export CC=gcc
223+
export CXX=g++
224+
ACTION="ci/build_cmake_embedded.sh"
225+
export ARCH="64"
226+
fi
227+
228+
# install boost
229+
wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2
230+
tar xf boost_1_71_0.tar.bz2
231+
cd boost_1_71_0
232+
./bootstrap.sh
233+
./b2 -j4 --prefix=${BASE}/usr --with-chrono --with-context --with-filesystem --with-system --with-timer address-model=${ARCH} install
234+
cd ..
235+
236+
# install gtest
237+
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
238+
unzip -q googletest-release-1.7.0.zip
239+
cd googletest-release-1.7.0
240+
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c -fPIC
241+
$CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c -fPIC
242+
ar -rv libgtest.a gtest-all.o
243+
ar -rv libgtest_main.a gtest_main.o
244+
mkdir -p ${BASE}/usr/include
245+
cp -r include/gtest ${BASE}/usr/include
246+
mkdir -p ${BASE}/usr/lib
247+
mv *.a ${BASE}/usr/lib
248+
cd ..
249+
250+
# install zlib
251+
if [ ${ARCH} == 32 ]; then
252+
sudo apt-get install lib32z1-dev
253+
fi
254+
255+
# build and test
256+
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" MSGPACK_SAN="${SAN}" ${ACTION}
257+
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
258+
windows:
259+
runs-on: windows-2016
260+
strategy:
261+
matrix:
262+
pattern: [0, 1, 2, 3]
263+
steps:
264+
- uses: actions/checkout@v1
265+
- name: download
266+
shell: bash
267+
run: |
268+
curl -L -o googletest-release-1.7.0.zip https://github.com/google/googletest/archive/release-1.7.0.zip
269+
curl -L -O http://zlib.net/zlib-1.2.11.tar.gz
270+
pwd
271+
ls -l
272+
- name: build and test
273+
shell: powershell
274+
run: |
275+
if (${{ matrix.pattern }} -eq 0) {
276+
$CPP11="-DMSGPACK_CXX11=""OFF"""
277+
$BOOST="-DMSGPACK_BOOST=""OFF"""
278+
}
279+
if (${{ matrix.pattern }} -eq 1) {
280+
$CPP11="-DMSGPACK_CXX11=""OFF"""
281+
$BOOST="-DMSGPACK_BOOST=""ON"""
282+
}
283+
if (${{ matrix.pattern }} -eq 2) {
284+
$CPP11="-DMSGPACK_CXX11=""ON"""
285+
$BOOST="-DMSGPACK_BOOST=""OFF"""
286+
}
287+
if (${{ matrix.pattern }} -eq 3) {
288+
$CPP11="-DMSGPACK_CXX11=""ON"""
289+
$BOOST="-DMSGPACK_BOOST=""ON"""
290+
}
291+
292+
$CUR=(Get-Location).Path
293+
7z x googletest-release-1.7.0.zip
294+
cd googletest-release-1.7.0
295+
md build
296+
cd build
297+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="/D_VARIADIC_MAX=10 /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" ..
298+
cmake --build . --config Release
299+
cd ..
300+
cd ..
301+
302+
7z x zlib-1.2.11.tar.gz
303+
7z x zlib-1.2.11.tar
304+
cd zlib-1.2.11
305+
md build
306+
cd build
307+
cmake ..
308+
cmake --build . --config Release
309+
copy zconf.h ..
310+
cd ..
311+
cd ..
312+
313+
md build
314+
cd build
315+
echo $env:BOOST_ROOT
316+
$env:DBOOST_ROOT="$env:Boost_ROOT"
317+
Start-Process cmake -ArgumentList "-DBOOST_ROOT=""$env:BOOST_ROOT"" $CPP11 $BOOST $X3_PARSE -DGTEST_LIBRARY=""$CUR\googletest-release-1.7.0\build\Release\gtest.lib"" -DGTEST_MAIN_LIBRARY=""$CUR\googletest-release-1.7.0\build\Release\gtest_main.lib"" -DGTEST_INCLUDE_DIR=""$CUR\googletest-release-1.7.0\include"" -DZLIB_LIBRARY=""$CUR\zlib-1.2.11\build\Release\zlib.lib"" -DZLIB_INCLUDE_DIR=""$CUR\zlib-1.2.11"" -DCMAKE_CXX_FLAGS=""/D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"" .." -NoNewWindow -Wait
318+
cmake --build . --config Release
319+
$env:PATH="$env:PATH;$CUR\googletest-release-1.7.0\build\Release;$CUR\zlib-1.2.11\build\Release;$CUR\build\release"
320+
ctest -V

0 commit comments

Comments
 (0)