2021-10-09 23:15:08 +02:00
|
|
|
name: "Unit Tests"
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
2022-06-29 00:24:53 +02:00
|
|
|
workflow_dispatch:
|
2021-10-09 23:15:08 +02:00
|
|
|
|
|
|
|
jobs:
|
2021-10-09 23:30:35 +02:00
|
|
|
tests:
|
|
|
|
name: 🧪 Unit Tests
|
2022-06-25 12:19:59 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-09 23:15:08 +02:00
|
|
|
permissions:
|
|
|
|
actions: read
|
|
|
|
contents: read
|
|
|
|
security-events: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: 🧰 Checkout
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-10-09 23:15:08 +02:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
2022-06-29 00:24:53 +02:00
|
|
|
- name: 📜 Restore ccache
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/cache@v3
|
2021-10-09 23:15:08 +02:00
|
|
|
with:
|
|
|
|
path: |
|
2022-06-27 00:20:32 +02:00
|
|
|
~/.cache/ccache
|
2022-06-29 00:24:53 +02:00
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
|
|
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build
|
|
|
|
|
2021-10-09 23:15:08 +02:00
|
|
|
|
2022-06-29 00:24:53 +02:00
|
|
|
- name: 📜 Restore CMakeCache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
build/CMakeCache.txt
|
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}
|
|
|
|
|
2021-10-09 23:15:08 +02:00
|
|
|
- name: ⬇️ Install dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo bash dist/get_deps_debian.sh
|
|
|
|
|
|
|
|
- name: 🛠️ Build
|
|
|
|
run: |
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2022-06-25 12:19:59 +02:00
|
|
|
CC=gcc-12 CXX=g++-12 cmake \
|
2022-01-13 21:31:01 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
2021-10-09 23:15:08 +02:00
|
|
|
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
|
2022-01-13 21:31:01 +01:00
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_C_FLAGS="-fuse-ld=lld" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
|
2021-10-09 23:15:08 +02:00
|
|
|
..
|
2021-12-14 21:26:59 +01:00
|
|
|
make -j4 unit_tests install
|
2021-10-09 23:15:08 +02:00
|
|
|
|
|
|
|
- name: 🧪 Perform Unit Tests
|
|
|
|
run: |
|
|
|
|
cd build
|
|
|
|
ctest
|