2021-10-09 23:15:08 +02:00
|
|
|
name: "Unit Tests"
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-02-29 22:28:29 +01:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
- 'releases/**'
|
2024-05-11 21:42:15 +02:00
|
|
|
- 'tests/**'
|
2021-10-09 23:15:08 +02:00
|
|
|
pull_request:
|
2024-02-29 22:28:29 +01:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
- 'releases/**'
|
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
|
2024-01-28 22:10:37 +01:00
|
|
|
uses: actions/checkout@v4
|
2021-10-09 23:15:08 +02:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
2022-10-10 20:37:00 +02:00
|
|
|
- name: 📜 Setup ccache
|
2024-01-30 21:19:25 +01:00
|
|
|
uses: hendrikmuhs/ccache-action@v1
|
2021-10-09 23:15:08 +02:00
|
|
|
with:
|
2023-10-04 22:23:41 +02:00
|
|
|
key: ${{ runner.os }}-tests-build-${{ github.run_id }}
|
|
|
|
restore-keys: ${{ runner.os }}-tests-build
|
2022-10-10 20:37:00 +02:00
|
|
|
max-size: 50M
|
2023-01-30 10:42:07 +01:00
|
|
|
|
2021-10-09 23:15:08 +02:00
|
|
|
- name: ⬇️ Install dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo bash dist/get_deps_debian.sh
|
2024-05-17 21:08:22 +02:00
|
|
|
sudo apt install gcovr -y
|
2021-10-09 23:15:08 +02:00
|
|
|
|
|
|
|
- name: 🛠️ Build
|
|
|
|
run: |
|
2023-11-25 15:42:51 +01:00
|
|
|
set -x
|
2021-10-09 23:15:08 +02:00
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2024-05-18 20:35:49 +02:00
|
|
|
CC=gcc-12 CXX=g++-12 cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DIMHEX_ENABLE_UNIT_TESTS=ON \
|
2024-06-25 21:54:48 +02:00
|
|
|
-DIMHEX_ENABLE_PLUGIN_TESTS=ON \
|
2024-05-18 20:35:49 +02:00
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_C_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage" \
|
|
|
|
-DIMHEX_OFFLINE_BUILD=ON \
|
2021-10-09 23:15:08 +02:00
|
|
|
..
|
2023-01-13 00:32:17 +01:00
|
|
|
make -j4 unit_tests
|
2021-10-09 23:15:08 +02:00
|
|
|
|
2024-05-12 02:19:20 +02:00
|
|
|
- name: 🧪 Perform plcli Integration Tests
|
|
|
|
run: |
|
|
|
|
cd lib/external/pattern_language
|
|
|
|
python tests/integration/integration.py ../../../build/imhex --pl
|
|
|
|
|
2021-10-09 23:15:08 +02:00
|
|
|
- name: 🧪 Perform Unit Tests
|
|
|
|
run: |
|
|
|
|
cd build
|
2022-08-15 23:49:42 +02:00
|
|
|
ctest --output-on-failure
|
2024-01-25 21:23:03 +01:00
|
|
|
|
2024-05-17 21:08:22 +02:00
|
|
|
# Generate report from all gcov .gcda files
|
|
|
|
- name: 🧪 Generate coverage report
|
|
|
|
run: |
|
|
|
|
gcovr --gcov-executable /usr/bin/gcov-12 -r . build --xml coverage_report.xml --verbose
|
|
|
|
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
|
|
uses: codecov/codecov-action@v4
|
|
|
|
with:
|
|
|
|
fail_ci_if_error: true
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
file: coverage_report.xml
|
|
|
|
|
2024-01-25 21:23:03 +01:00
|
|
|
langs:
|
|
|
|
name: 🧪 Langs
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: 🧰 Checkout
|
2024-01-28 22:10:37 +01:00
|
|
|
uses: actions/checkout@v4
|
2024-01-25 21:23:03 +01:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Check langs
|
|
|
|
run:
|
|
|
|
python3 tests/check_langs.py
|