-
Notifications
You must be signed in to change notification settings - Fork 68
285 lines (232 loc) · 9.36 KB
/
logs_on_demand.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: 'logs_on_demand'
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
# Linux build, test, and publish
linux-install:
name: "Linux | Install | ${{ matrix.compiler }} | ${{ matrix.config }} | ${{ matrix.vendored_dependencies }}"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
compiler:
- gcc
config:
- release
vendored_dependencies: [true]
env:
artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
if: ${{ matrix.vendored_dependencies }}
- name: Checkout code
uses: actions/checkout@v4
if: ${{ !matrix.vendored_dependencies }}
# Fetch tags for CMakeLists version check
# https://github.com/actions/checkout/issues/701
- name: Git fetch tags
run: git fetch --tags origin
- uses: ./.github/linux-setup
with:
compiler: ${{ matrix.compiler }}
ccache-key: linux-install-${{ matrix.compiler }}-${{ matrix.config }}
- name: Install vendored dependencies
if: ${{ !matrix.vendored_dependencies }}
run: |
git clone https://github.com/google/flatbuffers.git
pushd flatbuffers
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=ON . && cmake --build build && sudo cmake --install build
popd
git clone https://github.com/google/googletest.git
pushd googletest
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=ON . && cmake --build build && sudo cmake --install build
popd
git clone https://github.com/capnproto/capnproto.git
pushd capnproto
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON . && cmake --build build && sudo cmake --install build
popd
git clone https://github.com/chipsalliance/UHDM.git
pushd UHDM
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DUHDM_USE_HOST_GTEST=ON -DUHDM_USE_HOST_CAPNP=ON . && cmake --build build && sudo cmake --install build
popd
sudo mkdir -p /usr/share/java
sudo wget https://www.antlr.org/download/antlr-4.12.0-complete.jar -P /usr/share/java
wget https://www.antlr.org/download/antlr4-cpp-runtime-4.12.0-source.zip && mkdir antlr4
pushd antlr4
unzip ../antlr4-cpp-runtime-4.12.0-source.zip && cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=ON . && cmake --build build && sudo cmake --install build
popd
- name: Build, install & test
run: |
if [ "${{ matrix.config }}" == "debug" ]; then
export BUILD_TYPE=Debug
export CMAKE_ADDITIONAL_ARGS=-DSURELOG_WITH_TCMALLOC=Off
else
export BUILD_TYPE=Release
export CMAKE_ADDITIONAL_ARGS=
fi
export INSTALL_DIR=`pwd`/install
if [ "${{ matrix.vendored_dependencies }}" == "false" ]; then
# Ensure that vendored dependencies' shared libraries are available
# for any run checks, such as those in the `TestInstall` project
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
fi
if [ "${{ matrix.vendored_dependencies }}" == "false" ]; then
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DBUILD_SHARED_LIBS=ON -DSURELOG_USE_HOST_FLATBUFFERS=ON -DSURELOG_USE_HOST_ANTLR=ON -DSURELOG_USE_HOST_UHDM=ON -DSURELOG_USE_HOST_GTEST=ON -DSURELOG_WITH_TCMALLOC=OFF -DCMAKE_MODULE_PATH="/usr/share/CMake/Modules;/usr/local/lib/cmake" -S . -B build
else
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $CMAKE_ADDITIONAL_ARGS -S . -B build
fi
cmake --build build -j $(nproc)
cmake --install build
cmake --build build --target UnitTests -j $(nproc)
pushd build && ctest --output-on-failure && popd
rm -rf build # make sure we only see installation artifacts
# this shouldnt be necessary, and can't be reproduced outside CI
export CMAKE_PREFIX_PATH=$INSTALL_DIR
if [ "${{ matrix.vendored_dependencies }}" == "false" ]; then
cmake -DCMAKE_BUILD_TYPE=Release -DINSTALL_DIR=$INSTALL_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DBUILD_SHARED_LIBS=ON -DSURELOG_USE_HOST_FLATBUFFERS=ON -DSURELOG_USE_HOST_ANTLR=ON -DSURELOG_USE_HOST_UHDM=ON -DSURELOG_USE_HOST_GTEST=ON -S tests/TestInstall -B tests/TestInstall/build
else
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINSTALL_DIR=$INSTALL_DIR -S tests/TestInstall -B tests/TestInstall/build
fi
cmake --build tests/TestInstall/build -j $(nproc)
echo "-- pkg-config content --"
cat $INSTALL_DIR/lib/pkgconfig/Surelog.pc
PREFIX=$INSTALL_DIR make test_install_pkgconfig
- name: Prepare build artifacts
run: |
mkdir artifacts
mv install ${{ env.artifact-name }}
tar czfp artifacts/${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }}
if: ${{ matrix.vendored_dependencies }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact-name }}
path: artifacts/${{ env.artifact-name }}.tar.gz
if: ${{ matrix.vendored_dependencies }}
# Linux regression
linux-regression:
name: "Linux | Regression | ${{ matrix.compiler }} | ${{ matrix.config }} [${{ matrix.shard }}]"
runs-on: ubuntu-24.04
needs: linux-install
strategy:
fail-fast: false
matrix:
num_shards: [6]
shard: [0, 1, 2, 3, 4, 5]
compiler:
- gcc
config:
- release
env:
build-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}
regression-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}-regression-${{ matrix.shard }}
steps:
- name: Install dependencies
run: |
sudo apt-get update -qq &&
sudo apt install -y google-perftools libgoogle-perftools-dev
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
- name: Setup Python Packages
run: |
pip3 install orderedmultidict
pip3 install psutil
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.build-artifact-name }}
- name: Run regression ${{ matrix.shard }}/${{ matrix.num_shards }}
timeout-minutes: 120
run: |
tar xzfp ${{ env.build-artifact-name }}.tar.gz
mv ${{ env.build-artifact-name }} build
rm ${{ env.build-artifact-name }}.tar.gz
python3 scripts/regression.py run \
--uhdm-lint-filepath bin/uhdm-lint \
--jobs $(nproc) \
--show-diffs \
--num_shards=${{ matrix.num_shards }} \
--shard=${{ matrix.shard }}
git status
- name: Prepare regression artifacts
if: always()
run: |
cd build
mv regression ${{ env.regression-artifact-name }}
find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T -
- name: Upload regression artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.regression-artifact-name }}
path: build/${{ env.regression-artifact-name }}.tar.gz
# Code formatting
CodeFormatting:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get install clang-format-18
clang-format --version
- name: Run formatting style check
run: ./.github/bin/run-clang-format.sh
# Code Tideness
ClangTidy:
runs-on: ubuntu-24.04
steps:
- name: Install Dependencies
run: |
sudo apt-get update -qq
sudo apt -qq -y install clang-tidy-18 \
g++-9 default-jre cmake \
uuid-dev build-essential
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
- name: Setup Python Packages
run: |
pip3 install orderedmultidict
pip3 install psutil
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Use ccache
uses: hendrikmuhs/[email protected]
with:
key: clang-tidy-codegen
- name: Configure shell
run: |
echo 'PATH=/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV
- name: Prepare source
run: |
make run-cmake-release
make -j2 -C build GenerateParser
make -j2 -C build GenerateParserListeners
make -j2 -C build GenerateCacheSerializers
ln -sf build/compile_commands.json .
- name: Run clang tidy
run: |
./.github/bin/run-clang-tidy.sh limited