Skip to content

Commit 857c037

Browse files
committed
add github actions CI
1 parent 3fb9d92 commit 857c037

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore:
7+
- '**.md'
8+
- 'LICENSE'
9+
pull_request:
10+
types: [opened, synchronize]
11+
paths-ignore:
12+
- '**.md'
13+
- 'LICENSE'
14+
15+
jobs:
16+
linux:
17+
runs-on: ubuntu-latest
18+
if: "!contains(github.event.head_commit.message, 'ci skip')"
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
mem_check:
23+
- ENABLE_VALGRIND
24+
- ENABLE_SANITIZERS
25+
- NONE_MEM_CHECK
26+
compiler:
27+
- GCC
28+
- CLANG
29+
steps:
30+
- uses: actions/checkout@v2
31+
- name: install build dependencies
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install clang-8 valgrind
35+
- name: build and test
36+
shell: bash
37+
run: |
38+
if [ "${{ matrix.mem_check }}" == "ENABLE_VALGRIND" ]; then
39+
EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=ON -DENABLE_SAFE_STACK=ON -DENABLE_SANITIZERS=OFF"
40+
elif [ "${{ matrix.mem_check }}" == "ENABLE_SANITIZERS" ]; then
41+
EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=ON"
42+
else
43+
EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=OFF"
44+
fi
45+
if [ "${{ matrix.compiler }}" == "GCC" ]; then
46+
export CC=gcc
47+
else
48+
export CC=clang
49+
fi
50+
#run build and test
51+
JOBS=20
52+
export CTEST_PARALLEL_LEVEL=$JOBS
53+
export CTEST_OUTPUT_ON_FAILURE=1
54+
mkdir -p build
55+
cd build
56+
echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS
57+
cmake .. $EVENT_CMAKE_OPTIONS || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS)
58+
cmake --build .
59+
make
60+
make test
61+
62+
macos:
63+
runs-on: macos-latest
64+
if: "!contains(github.event.head_commit.message, 'ci skip')"
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
mem_check:
69+
- ENABLE_VALGRIND
70+
- ENABLE_SANITIZERS
71+
- NONE_MEM_CHECK
72+
compiler:
73+
- GCC
74+
- CLANG
75+
steps:
76+
- uses: actions/checkout@v2
77+
- name: build and test
78+
shell: bash
79+
run: |
80+
if [ "${{ matrix.mem_check }}" == "ENABLE_VALGRIND" ]; then
81+
EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=ON -DENABLE_SAFE_STACK=ON -DENABLE_SANITIZERS=OFF"
82+
elif [ "${{ matrix.mem_check }}" == "ENABLE_SANITIZERS" ]; then
83+
EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=ON"
84+
else
85+
EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=OFF"
86+
fi
87+
if [ "${{ matrix.compiler }}" == "GCC" ]; then
88+
export CC=gcc
89+
else
90+
export CC=clang
91+
fi
92+
#run build and test
93+
JOBS=20
94+
export CTEST_PARALLEL_LEVEL=$JOBS
95+
export CTEST_OUTPUT_ON_FAILURE=1
96+
mkdir -p build
97+
cd build
98+
echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS
99+
cmake .. $EVENT_CMAKE_OPTIONS || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS)
100+
cmake --build .
101+
make
102+
make test

0 commit comments

Comments
 (0)