From abf1d9ad6988be36475e4435bfc04f7a67f7d658 Mon Sep 17 00:00:00 2001 From: lukasz126 Date: Mon, 12 Feb 2024 01:30:06 +0100 Subject: [PATCH 01/12] Basic version of github actions --- .github/workflows/ci_basic.yaml | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/ci_basic.yaml diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml new file mode 100644 index 0000000..27491b6 --- /dev/null +++ b/.github/workflows/ci_basic.yaml @@ -0,0 +1,40 @@ +name: Basic CI ubuntu + +on: [push, pull_request, workflow_dispatch] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + BUILD_PATH: ${{github.workspace}}/communicator/build + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install Qt + uses: jurplel/install-qt-action@v3 # Installs Qt. + with: + version: '6.2.1' # The version of Qt to install. + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.14 + with: + cmake-version: '3.22.1' + + - name: Configure CMake + run: cmake -B ${{env.BUILD_PATH}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{env.BUILD_PATH}} --config ${{env.BUILD_TYPE}} + + - name: Pre-commit actions + uses: pre-commit/action@v3.0.1 + + # TODO uncomment when tests are added + # - name: Test + # working-directory: ${{env.BUILD_PATH}} + # run: ctest -C ${{env.BUILD_TYPE}} From 3b6a7465f8f00fce5011d5114a0d4c2f4b9259ba Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:05:44 +0100 Subject: [PATCH 02/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index 27491b6..c4abcb6 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -18,7 +18,7 @@ jobs: uses: jurplel/install-qt-action@v3 # Installs Qt. with: version: '6.2.1' # The version of Qt to install. - + - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.14 with: From d3f915e5800d5b0d7ce5d2d63c9984bc746fa022 Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:44:25 +0100 Subject: [PATCH 03/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index c4abcb6..b13ef58 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -6,6 +6,7 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release BUILD_PATH: ${{github.workspace}}/communicator/build + SOURCE: ${{github.workspace}}/communicator jobs: build: @@ -25,7 +26,7 @@ jobs: cmake-version: '3.22.1' - name: Configure CMake - run: cmake -B ${{env.BUILD_PATH}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: cmake -B ${{env.BUILD_PATH}} -S ${{env.SOURCE}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build # Build your program with the given configuration From b46d63f3a93fdc52ccb6bb39301e876f7655c8ed Mon Sep 17 00:00:00 2001 From: lukasz126 Date: Mon, 12 Feb 2024 01:30:06 +0100 Subject: [PATCH 04/12] qt generated files added to ignored in pre-commit installing pre-commit dependiencies added in github actions --- .github/workflows/ci_basic.yaml | 47 +++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 8 +++--- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci_basic.yaml diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml new file mode 100644 index 0000000..4252c6e --- /dev/null +++ b/.github/workflows/ci_basic.yaml @@ -0,0 +1,47 @@ +name: Basic CI ubuntu + +on: [push, pull_request, workflow_dispatch] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + BUILD_PATH: ${{github.workspace}}/communicator/build + SOURCE: ${{github.workspace}}/communicator + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install Qt + uses: jurplel/install-qt-action@v3 # Installs Qt. + with: + version: '6.2.1' # The version of Qt to install. + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.14 + with: + cmake-version: '3.22.1' + + - name: Configure CMake + run: cmake -B ${{env.BUILD_PATH}} -S ${{env.SOURCE}}-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{env.BUILD_PATH}} --config ${{env.BUILD_TYPE}} + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y llvm cppcheck + apt-get install -y iwyu + + - name: Pre-commit actions + uses: pre-commit/action@v3.0.1 + + # TODO uncomment when tests are added + # - name: Test + # working-directory: ${{env.BUILD_PATH}} + # run: ctest -C ${{env.BUILD_TYPE}} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d874f4..c1675b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,9 +4,9 @@ repos: hooks: - id: clang-format args: [--style=Google] + exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$' #auto generated files - id: clang-tidy - - id: oclint - - id: uncrustify + exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$' #auto generated files - id: cppcheck - - id: cpplint - - id: include-what-you-use \ No newline at end of file + - id: include-what-you-use + exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$' #auto generated files \ No newline at end of file From ac16fa86c07e485d2ea827001cb9acbfdd2360e8 Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Tue, 20 Feb 2024 01:26:58 +0100 Subject: [PATCH 05/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index 69ee746..7c6255a 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -19,7 +19,7 @@ jobs: uses: jurplel/install-qt-action@v3 # Installs Qt. with: version: '6.2.1' # The version of Qt to install. - + - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.14 with: @@ -45,4 +45,4 @@ jobs: # - name: Test # working-directory: ${{env.BUILD_PATH}} # run: ctest -C ${{env.BUILD_TYPE}} - \ No newline at end of file + From 822a777ebce680a6bdf348d9515ee8e97bc008df Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Tue, 20 Feb 2024 01:36:47 +0100 Subject: [PATCH 06/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index 7c6255a..fc418af 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -26,7 +26,7 @@ jobs: cmake-version: '3.22.1' - name: Configure CMake - run: cmake -B ${{env.BUILD_PATH}} -S ${{env.SOURCE}}-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: cmake -B ${{env.BUILD_PATH}} -S ${{env.SOURCE}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build # Build your program with the given configuration From 7336b3398c520c5156505ad41c98cef848c835ad Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Tue, 20 Feb 2024 01:41:07 +0100 Subject: [PATCH 07/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index fc418af..d0fdca2 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -36,7 +36,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y llvm cppcheck - apt-get install -y iwyu + sudo apt-get install -y iwyu - name: Pre-commit actions uses: pre-commit/action@v3.0.1 From 0684305ccca6928fec1464072b85b17c5fa60ce6 Mon Sep 17 00:00:00 2001 From: lukasz126 Date: Wed, 21 Feb 2024 00:57:22 +0100 Subject: [PATCH 08/12] added gtest --- .github/workflows/ci_basic.yaml | 9 +++++---- communicator/tests/CMakeLists.txt | 18 ++++++++++++++++++ communicator/tests/exampleTest.cpp | 9 +++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 communicator/tests/CMakeLists.txt create mode 100644 communicator/tests/exampleTest.cpp diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index d0fdca2..45f7564 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -7,6 +7,8 @@ env: BUILD_TYPE: Release BUILD_PATH: ${{github.workspace}}/communicator/build SOURCE: ${{github.workspace}}/communicator + TEST_BUILD_PATH: ${{github.workspace}}/communicator/tests/build + jobs: build: @@ -41,8 +43,7 @@ jobs: - name: Pre-commit actions uses: pre-commit/action@v3.0.1 - # TODO uncomment when tests are added - # - name: Test - # working-directory: ${{env.BUILD_PATH}} - # run: ctest -C ${{env.BUILD_TYPE}} + - name: Test + working-directory: ${{env.TEST_BUILD_PATH}} + run: ctest -C ${{env.BUILD_TYPE}} diff --git a/communicator/tests/CMakeLists.txt b/communicator/tests/CMakeLists.txt new file mode 100644 index 0000000..a329cb8 --- /dev/null +++ b/communicator/tests/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.5) +project(CommunicatorGTest) + +include(FetchContent) +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG main +) + +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(googletest) + +# Now simply link against gtest or gtest_main as needed. Eg +add_executable(example-gt exampleTest.cpp) +target_link_libraries(example-gt gtest_main) +enable_testing() +add_test(NAME example_test COMMAND example-gt) \ No newline at end of file diff --git a/communicator/tests/exampleTest.cpp b/communicator/tests/exampleTest.cpp new file mode 100644 index 0000000..8983b2d --- /dev/null +++ b/communicator/tests/exampleTest.cpp @@ -0,0 +1,9 @@ +#include "gtest/gtest.h" + +// Demonstrate some basic assertions. +TEST(exampleTest, BasicAssertions) { + // Expect two strings not to be equal. + EXPECT_STRNE("hello", "world"); + // Expect equality. + EXPECT_EQ(7 * 6, 42); +} \ No newline at end of file From b11aa86a5fa528b441609f83347a6cf8df260c71 Mon Sep 17 00:00:00 2001 From: lukasz126 Date: Wed, 21 Feb 2024 00:57:22 +0100 Subject: [PATCH 09/12] added gtest --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1675b8..92b9ea4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: args: [--style=Google] exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$' #auto generated files - id: clang-tidy - exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$' #auto generated files + exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$|^communicator/tests/exampleTest.cpp$' #auto generated files - id: cppcheck - id: include-what-you-use - exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$' #auto generated files \ No newline at end of file + exclude: '^communicator/main.cpp$|^communicator/mainwindow.cpp$|^communicator/mainwindow.h$|^communicator/tests/exampleTest.cpp$' #auto generated files \ No newline at end of file From 021714a4b451f6a57d482481786cd7a4ad0dbb94 Mon Sep 17 00:00:00 2001 From: lukasz126 Date: Wed, 21 Feb 2024 00:57:22 +0100 Subject: [PATCH 10/12] added gtest --- .github/workflows/ci_basic.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index 45f7564..ff1cd8a 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -43,6 +43,10 @@ jobs: - name: Pre-commit actions uses: pre-commit/action@v3.0.1 + - name: BuildTests + # Build your program with the given configuration + run: cmake --build ${{env.TEST_BUILD_PATH}} --config ${{env.BUILD_TYPE}} + - name: Test working-directory: ${{env.TEST_BUILD_PATH}} run: ctest -C ${{env.BUILD_TYPE}} From 23ba0c86a2a18a3d4a1625df559efdf03f813c01 Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Wed, 21 Feb 2024 01:28:47 +0100 Subject: [PATCH 11/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index ff1cd8a..f3c079c 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -41,7 +41,10 @@ jobs: sudo apt-get install -y iwyu - name: Pre-commit actions - uses: pre-commit/action@v3.0.1 + uses: pre-commit/action@v3.0.1 + + - name: Configure Test CMake + run: cmake -B ${{env.TEST_BUILD_PATH}} -S ${{env.TEST_SOURCE}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: BuildTests # Build your program with the given configuration From 86274230cc9fb4250fed70ed93581ebcf34d11ba Mon Sep 17 00:00:00 2001 From: Lukasz_S <94768149+lukasz126@users.noreply.github.com> Date: Wed, 21 Feb 2024 01:30:18 +0100 Subject: [PATCH 12/12] Update ci_basic.yaml --- .github/workflows/ci_basic.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_basic.yaml b/.github/workflows/ci_basic.yaml index f3c079c..b3c0b12 100644 --- a/.github/workflows/ci_basic.yaml +++ b/.github/workflows/ci_basic.yaml @@ -8,6 +8,7 @@ env: BUILD_PATH: ${{github.workspace}}/communicator/build SOURCE: ${{github.workspace}}/communicator TEST_BUILD_PATH: ${{github.workspace}}/communicator/tests/build + TEST_SOURCE: ${{github.workspace}}/communicator/tests jobs: