From 6b1e063db8dfc8253aeae71f5e030bc0341bc480 Mon Sep 17 00:00:00 2001 From: Mika Tuupola Date: Sun, 21 Dec 2025 12:00:28 +0200 Subject: [PATCH 1/2] Run cicd via cmake --- .github/workflows/ccpp.yml | 10 +++++++--- README.md | 9 +++++++++ tests/CMakeLists.txt | 9 +++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/CMakeLists.txt diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 21f3f72..286f66e 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -12,6 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: make check - run: make check + - uses: actions/checkout@v4 + - name: Configure + run: cmake -B build -DBM8563_BUILD_TESTS=ON + - name: Build + run: cmake --build build + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/README.md b/README.md index d6623f9..ff4e8b9 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,15 @@ while (1) { ``` +## Run unit tests + +``` +$ mkdir build && cd build +$ cmake -DBM8563_BUILD_TESTS=ON .. +$ make +$ ctest +``` + ## License diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..d5a5194 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,9 @@ +add_executable(unit unit.c mock_i2c.c) +target_link_libraries(unit PRIVATE bm8563) +target_compile_options(unit PRIVATE + -Wmissing-declarations + -Wmissing-prototypes + -Wstrict-prototypes +) + +add_test(NAME unit COMMAND unit) \ No newline at end of file From ca9c955bb5cd676ac048e25b9eb29b486bdf0152 Mon Sep 17 00:00:00 2001 From: Mika Tuupola Date: Sun, 21 Dec 2025 12:03:16 +0200 Subject: [PATCH 2/2] Ignore crud --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6b4845 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +tests/unit +*.o