-
Notifications
You must be signed in to change notification settings - Fork 24
211 lines (171 loc) · 5.72 KB
/
unit_test.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: unit tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
skip_duplicate:
name: 'Check whether to skip job'
continue-on-error: true
runs-on: ubuntu-latest
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths: '["tpie/", "test/"]'
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
linux_test:
name: 'Unit test (Linux, ${{matrix.cc.cc}}-${{matrix.cc.v}}, ${{matrix.build_type}})'
runs-on: ${{ matrix.os }}
needs: skip_duplicate
if: ${{ needs.skip_duplicate.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build_type: [Release] #, Debug, ExtraDebug]
cc:
# GNU Compiler
- { cc: gcc, v: 7, cxx: g++ } # oldest possible
- { cc: gcc, v: 9, cxx: g++ } # default
- { cc: gcc, v: 10, cxx: g++ } # newest
# Clang Compiler
- { cc: clang, v: 7, cxx: clang++ } # oldest possible
- { cc: clang, v: 11, cxx: clang++ } # newst possible
env:
cc: ${{matrix.cc.cc}}-${{matrix.cc.v}}
cxx: ${{matrix.cc.cxx}}-${{matrix.cc.v}}
macro_flags: '-DLZ4_compress_default\(a,b,c,d\)=LZ4_compress\(a,b,c\)'
steps:
# Git repo set up
- name: Checkout commit
uses: actions/checkout@v2
# Installation Linux
- name: Install dependencies
run: |
sudo apt update
echo "================================"
echo "Compiler"
sudo apt install build-essential
sudo apt install ${{matrix.cc.cc}}-${{matrix.cc.v}}
echo "================================"
echo "Boost"
sudo apt install libboost-all-dev
echo "================================"
echo "Snappy"
sudo apt install libsnappy-dev
echo "================================"
echo "LZ4"
sudo apt install liblz4-dev
echo "================================"
echo "ZSTD"
export CC=${{env.cc}}
export CCX=${{env.cxx}}
export MACRO_FLAGS="${{env.macro_flags}}"
git clone https://github.com/facebook/zstd
cd zstd
git checkout tags/v1.3.1
sudo make install
# CMake build and run
- name: CMake build
working-directory: ${{runner.workspace}}
run: |
export CC=${{env.cc}}
if [ "${{ matrix.cc.cc }}" != "gcc" ] ;
then
export CXX=${{env.cxx}}
fi
export MACRO_FLAGS="${{env.macro_flags}}"
cmake -E make_directory ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake -D CMAKE_BUILD_TYPE="${{matrix.build_type}}" -D CMAKE_CXX_STANDARD=14 -D CMAKE_C_FLAGS="$MACRO_FLAGS" -D CMAKE_CXX_FLAGS="$MACRO_FLAGS" ..
make -j2
- name: CTest run
working-directory: ${{github.workspace}}/build
run: ctest --timeout 30
# Check if tests are missing
- name: Check missing CTests
working-directory: ${{github.workspace}}
run: |
sudo apt install python3 python3-pip
pip install cmakeast
python3 scripts/check_missing_ctests.py
macos_test:
name: 'Unit test (Mac OS, ${{matrix.cc.cc}}@${{matrix.cc.v || matrix.cc.xcode}}, ${{matrix.build_type}})'
runs-on: ${{ matrix.os }}
needs: skip_duplicate
if: ${{ needs.skip_duplicate.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
build_type: [Release] #, Debug, ExtraDebug]
cc:
# GNU Compiler
- { cc: gcc, v: 7, cxx: g++, xcode: latest }
- { cc: gcc, v: 10, cxx: g++, xcode: latest }
# Clang Compiler
- { cc: clang, cxx: clang++, xcode: 11.7 } # oldest
- { cc: clang, cxx: clang++, xcode: 12.4 }
- { cc: clang, cxx: clang++, xcode: 13.1 }
- { cc: clang, cxx: clang++, xcode: 13.2 } # newest
steps:
# Git repo set up
- name: Checkout commit
uses: actions/checkout@v2
# Install dependencies
- name: Install xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{matrix.cc.xcode}}
- name: Install dependencies
run: |
brew update
if ["${{matrix.cc.cc}}" == "gcc"];
then
echo "================================"
echo "Compiler"
brew install ${{matrix.cc.cc}}@${{matrix.cc.v}}
fi
echo "================================"
echo "Boost"
brew install boost
echo "================================"
echo "Snappy"
brew install snappy
echo "================================"
echo "LZ4"
brew install lz4
echo "================================"
echo "ZSTD"
brew install zstd
# CMake build and run
- name: CMake build
working-directory: ${{runner.workspace}}
run: |
if [ "${{ matrix.cc.cc }}" == "gcc" ] ;
then
export CC=/usr/bin/${{matrix.cc.cc}}
export CXX=/usr/bin/${{matrix.cc.cxx}}
else
export CC=${{matrix.cc.cc}}
export CXX=${{matrix.cc.cxx}}
fi
cmake -E make_directory ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake -D CMAKE_BUILD_TYPE="${{matrix.build_type}}" -D CMAKE_CXX_STANDARD=14 ..
make -j2
- name: CTest run
working-directory: ${{github.workspace}}/build
run: ctest --timeout 30
# Check if tests are missing
- name: Check missing CTests
working-directory: ${{github.workspace}}
run: |
brew install python3
pip3 install cmakeast
python3 scripts/check_missing_ctests.py