From 6e8dd2b0fe40856cbc7b6e5ad0e21a98b61f60ce Mon Sep 17 00:00:00 2001 From: Simon Kagstrom Date: Fri, 21 Jun 2024 16:07:29 +0200 Subject: [PATCH] github-actions: Add basic build + unit test --- .github/FUNDING.yml | 1 + .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 1 + test/unittest/CMakeLists.txt | 2 ++ 4 files changed, 46 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f4c8101 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [SimonKagstrom] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6872879 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: EmilPRO CI + +on: [push, pull_request] + +jobs: + build: + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: | + if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then + sudo apt-get install -y g++ cmake ninja-build python3-pip binutils-multiarch-dev qt6-base-dev + pip3 install conan + else + brew install cmake ninja conan binutils qt6 + fi + conan profile detect -f + + - name: Install conan deps + run: conan install -of ${{github.workspace}}/build --build=missing -s build_type=Debug + + - name: Configure CMake + run: | + if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then + cmake -GNinja -DCMAKE_PREFIX_PATH="${{github.workspace}}/build/build/Debug/generators/" -DCMAKE_BUILD_TYPE=Debug + else + cmake -GNinja -DCMAKE_PREFIX_PATH="${{github.workspace}}/build/build/Debug/generators/;`brew --prefix binutils`" -DCMAKE_BUILD_TYPE=Debug + fi + + - name: Build + run: ninja -C ${{github.workspace}}/build + + - name: Test + run: ctest -C ${{github.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index ff3736e..a77b27d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ add_subdirectory(tools) # Unit tests are only built in debug mode if (CMAKE_BUILD_TYPE STREQUAL "Debug") + enable_testing() add_subdirectory(test) endif() diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index 8ee954d..1d4cc59 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -13,3 +13,5 @@ target_link_libraries(ut jump_lanes fmt::fmt ) + +add_test(NAME unittest COMMAND ut)