-
Notifications
You must be signed in to change notification settings - Fork 28
172 lines (168 loc) · 6.17 KB
/
ccpp.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
name: C/C++ CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
debug-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
compiler: [clang, gcc]
os: [ubuntu-22.04, macos-latest]
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
# Ubuntu installations
- name: Installing cmake on Ubuntu
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get install -y cmake
- name: Installing gcovr on Ubuntu
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get install -y gcovr
- name: Installing boost on Ubuntu
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get install -y libboost1.74 libboost1.74-dev
- name: Installing clang and clang tidy on Ubuntu
if: matrix.compiler == 'clang' && matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get install -y clang-14 clang-tidy-14
# macOS installations
- name: Installing gcc on macOS
if: matrix.os == 'macos-latest'
run: |
brew install gcc
- name: Selecting latest XCode
if: matrix.os == 'macos-latest'
run: |
sudo xcode-select -s "/Applications/Xcode_14.2.app"
- name: Installing boost on macOS
if: matrix.os == 'macos-latest'
run: |
brew install boost
- name: Installing z3 on macOS
if: matrix.os == 'macos-latest'
run: |
brew install z3
- name: Installing lcov on macOS (clang)
if: matrix.compiler == 'clang' && matrix.os == 'macos-latest'
run: |
brew install lcov
- name: Installing gcovr on macOS (gcc)
if: matrix.compiler == 'gcc' && matrix.os == 'macos-latest'
run: |
brew install gcovr
- name: Installing cppcheck on macOS
if: matrix.os == 'macos-latest'
run: |
brew install cppcheck
# building
- name: Bulding debug version
run: |
mkdir -p build-Debug
cd build-Debug
if [ "${{ matrix.os }}" = "macos-latest" ]; then
Z3_LOC=$(brew --prefix z3)
else
Z3_LOC=/usr
fi
if [ "${{ matrix.compiler }}" = "gcc" ]; then
CMAKE_CXX_COMPILER=g++-12
cmake .. -G "Unix Makefiles" -DZ3_LOC=$Z3_LOC -DCMAKE_BUILD_TYPE="Debug" -DBUILD_CPPCHECK=TRUE -DBUILD_CLANG_TIDY=TRUE -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DBUILD_CODE_COVERAGE=TRUE
else
if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then
CMAKE_CXX_COMPILER=$(which clang++-14)
CMAKE_C_COMPILER=$(which clang-14)
else
CMAKE_C_COMPILER=$(which clang)
CMAKE_CXX_COMPILER=$(which clang++)
fi
cmake .. -G "Unix Makefiles" -DZ3_LOC=$Z3_LOC -DCMAKE_BUILD_TYPE="Debug" -DBUILD_CPPCHECK=TRUE -DBUILD_CLANG_TIDY=TRUE -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
fi
make -j5
- name: Bulding release version
run: |
mkdir -p build-Release
cd build-Release
if [ "${{ matrix.os }}" = "macos-latest" ]; then
Z3_LOC=$(brew --prefix z3)
else
Z3_LOC=/usr
fi
if [ "${{ matrix.compiler }}" = "gcc" ]; then
CMAKE_CXX_COMPILER=g++-12
cmake .. -G "Unix Makefiles" -DZ3_LOC=$Z3_LOC -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER
else
if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then
CMAKE_CXX_COMPILER=$(which clang++-14)
CMAKE_C_COMPILER=$(which clang-14)
else
CMAKE_C_COMPILER=$(which clang)
CMAKE_CXX_COMPILER=$(which clang++)
fi
cmake .. -G "Unix Makefiles" -DZ3_LOC=$Z3_LOC -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
fi
make -j5
# tests
- name: Test TML execution
run: |
./build-Release/tml -ie "a(1)."
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd build-Release
ctest -j N --output-on-failure
cd -
# Ubuntu analyzes
# - name: Formatting
# if: matrix.compiler == 'clang' && matrix.os == 'ubuntu-22.04'
# run: |
# cd build-Debug
# make -j5 clang-format
- name: Running clang tidy on Ubuntu
if: matrix.compiler == 'clang' && matrix.os == 'ubuntu-22.04'
run: |
cd build-Debug
make -j5 clang-tidy
# - name: Generating coverage report on Ubuntu
# if: success() && matrix.compiler == 'gcc' && matrix.os == 'ubuntu-22.04'
# run: |
# sudo git clone https://github.com/linux-test-project/lcov
# cd lcov
# sudo make install
# cd ../
# echo `ls`
# /usr/local/bin/lcov -c -d ./build-Debug/src/CMakeFiles --gcov-tool /usr/bin/gcov -o coverage.info
# /usr/local/bin/lcov --remove coverage.info '/usr/*' --output-file coverage.info
# /usr/local/bin/lcov --list coverage.info # debug info
# bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
# macOS analyzes
- name: Running CPP check on macOS
if: matrix.compiler == 'clang' && matrix.os == 'macos-latest'
run: |
cd build-Debug
make -j5 cppcheck
# emscripten
- name: Installing emscripten for JS build
if: matrix.compiler == 'clang'
run: |
./get_emsdk.sh
# emscripten build
- name: Building tml.js and tmllib.js (NodeJS)
if: matrix.compiler == 'clang'
run: |
./release-js.sh
# run NodeJS regression tests
- name: Running NodeJS regression tests # TODO: build tmllib.js first
if: matrix.compiler == 'clang'
run: |
cd ./tests
./run_all_nodejs_regression_tests.sh
cd -