-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from coders-school/basic_github_actions
Basic version of github actions
- Loading branch information
Showing
4 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
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 | ||
TEST_BUILD_PATH: ${{github.workspace}}/communicator/tests/build | ||
TEST_SOURCE: ${{github.workspace}}/communicator/tests | ||
|
||
|
||
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/[email protected] | ||
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 | ||
sudo apt-get install -y iwyu | ||
- name: Pre-commit actions | ||
uses: pre-commit/[email protected] | ||
|
||
- 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 | ||
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}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |