Skip to content

Commit 769aac4

Browse files
committed
Add GitHub action to trigger unit tests
1 parent b4b1d55 commit 769aac4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/unit-tests.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- feature/unitTests
7+
8+
concurrency:
9+
group: unit-tests-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-and-test:
14+
name: Build & Test (Ubuntu)
15+
runs-on: ubuntu-latest
16+
env:
17+
CTEST_OUTPUT_ON_FAILURE: 1
18+
CCACHE_DIR: ${{ github.workspace }}/.ccache
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install dependencies
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y --no-install-recommends \
27+
ninja-build build-essential cmake \
28+
libboost-all-dev libspdlog-dev libtinyxml2-dev libconfig++-dev \
29+
libssl-dev libnl-3-dev zlib1g-dev ccache clang-tidy clang g++-12
30+
31+
- name: Configure (CMake)
32+
run: |
33+
cmake -S . -B build -GNinja -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release
34+
35+
- name: Build
36+
run: cmake --build build --parallel
37+
38+
- name: List tests (debug)
39+
run: ctest --test-dir build/tests -N
40+
41+
- name: Run unit tests
42+
run: |
43+
set -o pipefail
44+
ctest --test-dir build/tests --output-on-failure -j 2 | tee build/ctest-log.txt
45+
46+
- name: Upload test log
47+
if: always()
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: ctest-log
51+
path: build/ctest-log.txt
52+
if-no-files-found: warn

0 commit comments

Comments
 (0)