-
Notifications
You must be signed in to change notification settings - Fork 3
165 lines (149 loc) · 5.72 KB
/
unix.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
name: Unix Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
formatting:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install clang-format
env:
DEBIAN_FRONTEND: noninteractive
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 11
rm llvm.sh
sudo apt-get install -y --no-install-recommends clang-format-11
- name: Format files
run: find src include test exe -type f -a \( -name "*.cc" -o -name "*.h" \) -print0 | xargs -0 clang-format-11 -i
- name: Check for differences
run: |
git status --porcelain
git status --porcelain | xargs -I {} -0 test -z \"{}\"
build:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: MacOS Release
cxx: clang++
cc: clang
mode: Release
cxxflags: -stdlib=libc++
os: macos-latest
artifact: macos
- name: GCC 10 Release
cxx: g++-10
cc: gcc-10
mode: Release
os: ubuntu-20.04
artifact: linux
- name: GCC 10 Debug
cxx: g++-10
cc: gcc-10
mode: Debug
os: ubuntu-20.04
- name: Clang 11 Release
cxx: clang++-11
cc: clang-11
mode: Release
cxxflags: -stdlib=libc++
ldflags: -lc++abi
os: ubuntu-20.04
- name: Clang Tidy
cxx: clang++-11
cc: clang-11
mode: Debug
cxxflags: -stdlib=libc++
ldflags: -lc++abi
lint: true
os: ubuntu-20.04
- key: Clang 11 Sanitizer
cxx: clang++-11
cc: clang-11
mode: Release
cflags: -fsanitize=address,undefined -fno-omit-frame-pointer
cxxflags: -fsanitize=address,undefined -fno-omit-frame-pointer -stdlib=libc++
ldflags: -lc++abi
os: ubuntu-20.04
env:
UBSAN_OPTIONS: halt_on_error=1:abort_on_error=1
BUILDCACHE_COMPRESS: true
BUILDCACHE_ACCURACY: SLOPPY
BUILDCACHE_LUA_PATH: ${{ github.workspace }}/tools
BUILDCACHE_DIR: ${{ github.workspace }}/.buildcache
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
# ==== INSTALL ====
- name: Upgrade Packages
if: matrix.config.os != 'macos-latest'
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get update
- name: Install LLVM
if: matrix.config.os != 'macos-latest' && matrix.config.cc == 'clang-11'
env:
DEBIAN_FRONTEND: noninteractive
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 11
rm llvm.sh
sudo apt-get install -y --no-install-recommends libc++-11-dev libc++abi-11-dev clang-tidy-11
- name: Install Valgrind
if: matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-10'
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get install -y --no-install-recommends valgrind
# ==== CACHING ====
- name: buildcache Cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/.buildcache
key: buildcache-${{ matrix.config.os }}-${{ matrix.config.cc }}-${{ matrix.config.mode }}-${{ contains(matrix.config.cxxflags, 'sanitize') }}-${{ matrix.config.lint }}-${{ hashFiles('.pkg') }}-${{ hashFiles('**/*.h') }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
buildcache-${{ matrix.config.os }}-${{ matrix.config.cc }}-${{ matrix.config.mode }}-${{ contains(matrix.config.cxxflags, 'sanitize') }}-${{ matrix.config.lint }}-${{ hashFiles('.pkg') }}-${{ hashFiles('**/*.h') }}-
buildcache-${{ matrix.config.os }}-${{ matrix.config.cc }}-${{ matrix.config.mode }}-${{ contains(matrix.config.cxxflags, 'sanitize') }}-${{ matrix.config.lint }}-${{ hashFiles('.pkg') }}-
buildcache-${{ matrix.config.os }}-${{ matrix.config.cc }}-${{ matrix.config.mode }}-${{ contains(matrix.config.cxxflags, 'sanitize') }}-${{ matrix.config.lint }}-
- name: Dependencies Cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/deps
key: deps-${{ hashFiles('.pkg') }}
restore-keys: deps-
# ==== BUILD ====
- name: CMake
run: |
cmake \
-G Ninja -S . -B build \
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_C_FLAGS="${{ matrix.config.cflags }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.config.cxxflags }}" \
-DCMAKE_CXX_FLAGS_DEBUG="" \
-DCMAKE_CXX_LINKER_FLAGS=${{ matrix.config.ldflags }}" \
-DCMAKE_CXX_EXE_LINKER_FLAGS="${{ matrix.config.ldflags }} \
-DCMAKE_BUILD_TYPE=${{ matrix.config.mode }} \
-DEXPRESS2CPP_LINT=${{ matrix.config.lint }}
- name: Build
run: |
./build/bin/buildcache -z
cmake --build build --target express-test step-test
./build/bin/buildcache -s
# ==== TESTS ====
- name: Run Tests
run: |
./build/express-test
./build/step-test
# ==== VALGRIND ====
- name: Run Tests Valgrind
if: matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-10'
run: |
valgrind --error-exitcode=1 --show-reachable=yes --leak-check=full ./build/express-test
valgrind --error-exitcode=1 --show-reachable=yes --leak-check=full ./build/step-test