Skip to content

Commit a856114

Browse files
committed
Add CI using github actions
1 parent eaa402b commit a856114

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
container_image: ["fedora:latest", "ubuntu:latest"]
13+
compiler: [g++, clang++]
14+
optflag: ["-O0", "-O2"]
15+
memcheck: [off, asan, valgrind]
16+
container:
17+
image: ${{ matrix.container_image }}
18+
19+
steps:
20+
- uses: actions/checkout@v1
21+
- name: install dependencies (Fedora)
22+
if: ${{ matrix.container_image == 'fedora:latest' }}
23+
run: dnf -y install clang gcc-c++ valgrind libasan libubsan jq
24+
- name: install dependencies (Ubuntu)
25+
if: ${{ matrix.container_image == 'ubuntu:latest' }}
26+
run: |
27+
apt-get -y update
28+
apt-get -y install bash clang g++ valgrind libasan5 libubsan1 jq
29+
- name: build and test
30+
shell: bash
31+
run: |
32+
export CXX=${{ matrix.compiler }}
33+
export CXXFLAGS="-std=gnu++14 -pthread -lpthread ${{ matrix.optflag }} -Wall -Wextra"
34+
export TESTFLAG=""
35+
if [[ "${{ matrix.memcheck }}" = "asan" ]]; then
36+
export CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer"
37+
if [[ "${{ matrix.compiler }}" = "g++" ]]; then
38+
export CXXFLAGS="${CXXFLAGS} -fno-sanitize-recover"
39+
else
40+
export CXXFLAGS="${CXXFLAGS} -fno-sanitize-recover=all"
41+
fi
42+
elif [[ "${{ matrix.memcheck }}" = "valgrind" ]]; then
43+
export TESTFLAG="--valgrind"
44+
fi
45+
${{ matrix.compiler }} -o jtc $CXXFLAGS jtc.cpp
46+
python3 run_tests.py -v $TESTFLAG User\ Guide.md Walk-path\ tutorial.md README.md

0 commit comments

Comments
 (0)