-
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.
Add GitHub Actions CI/CD Run for liblog (#16)
* Added github actions workflow and tests folder Signed-off-by: Christoph <[email protected]> * Fixed lint issue in examples Signed-off-by: Christoph <[email protected]> * Fixed test include issue Signed-off-by: Christoph <[email protected]> * Removed unused cmake link in tests Signed-off-by: Christoph <[email protected]> * Cleaned up on calls for build and test Signed-off-by: Christoph <[email protected]> * Trying to fix CI run on PR Signed-off-by: Christoph <[email protected]> * Updating install and test ci script as per PR review change request Signed-off-by: Christoph <[email protected]> * Rolled back unrelated update to test trace example Signed-off-by: Christoph <[email protected]> * Rolled back unrelated update to test trace example Signed-off-by: Christoph <[email protected]> * Updated test names to follow EVerest conventions Signed-off-by: Christoph <[email protected]> * Update tests/liblog_test.cpp Co-authored-by: Andreas Heinrich <[email protected]> Signed-off-by: Christoph <[email protected]> * Update .github/workflows/build_and_test.yaml Co-authored-by: Andreas Heinrich <[email protected]> Signed-off-by: Christoph <[email protected]> * Update .github/workflows/build_and_test.yaml Co-authored-by: Andreas Heinrich <[email protected]> Signed-off-by: Christoph <[email protected]> --------- Signed-off-by: Christoph <[email protected]> Co-authored-by: Andreas Heinrich <[email protected]>
- Loading branch information
1 parent
19dce0e
commit 6e80d58
Showing
5 changed files
with
119 additions
and
1 deletion.
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,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
cmake \ | ||
-B build \ | ||
-S "$EXT_MOUNT/source" \ | ||
-G Ninja \ | ||
-DBUILD_TESTING=ON \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist" | ||
|
||
ninja -j$(nproc) -C build install | ||
|
||
ninja -j$(nproc) -C build test |
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,61 @@ | ||
# Please reference work here https://github.com/EVerest/everest-core/tree/main/.github/workflows | ||
# TODO: modify to reuse the above workflow to DRY up CI. | ||
|
||
name: Build and test liblog | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
runner: | ||
description: Which runner to use | ||
type: choice | ||
default: 'ubuntu-22.04' | ||
required: true | ||
options: | ||
- 'ubuntu-22.04' | ||
- 'large-ubuntu-22.04-xxl' | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout liblog | ||
uses: actions/checkout@v3 | ||
with: | ||
path: source | ||
- name: Run clang-format | ||
uses: everest/everest-ci/github-actions/[email protected] | ||
with: | ||
source-dir: source | ||
extensions: hpp,cpp | ||
exclude: cache | ||
install_and_test: | ||
name: Install and test | ||
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout liblog | ||
uses: actions/checkout@v3 | ||
with: | ||
path: source | ||
- name: Setup run scripts | ||
run: | | ||
mkdir scripts | ||
rsync -a source/.ci/build-kit/ scripts | ||
- name: Pull docker container | ||
run: | | ||
docker pull --platform=linux/x86_64 --quiet ghcr.io/everest/build-kit-alpine:latest | ||
docker image tag ghcr.io/everest/build-kit-alpine:latest build-kit | ||
- name: Run install with tests | ||
run: | | ||
docker run \ | ||
--volume "$(pwd):/ext" \ | ||
--name test-container \ | ||
build-kit run-script install_and_test | ||
- name: Archive test results | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ctest-report | ||
path: /workspace/build/tests/Testing/Temporary/LastTest.log | ||
|
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,17 @@ | ||
find_package(GTest REQUIRED) | ||
|
||
set(TEST_TARGET_NAME ${PROJECT_NAME}_tests) | ||
add_executable(${TEST_TARGET_NAME} liblog_test.cpp) | ||
|
||
target_include_directories(${TEST_TARGET_NAME} PUBLIC ${GTEST_INCLUDE_DIRS}) | ||
target_include_directories(log | ||
PUBLIC | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
) | ||
target_link_libraries(${TEST_TARGET_NAME} PRIVATE | ||
${GTEST_LIBRARIES} | ||
${GTEST_MAIN_LIBRARIES} | ||
) | ||
|
||
gtest_discover_tests(${TEST_TARGET_NAME}) |
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,22 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest | ||
#include <gtest/gtest.h> | ||
|
||
namespace Everest { | ||
namespace Logging { | ||
|
||
class LibLogUnitTest : public ::testing::Test { | ||
protected: | ||
void SetUp() override { | ||
} | ||
|
||
void TearDown() override { | ||
} | ||
}; | ||
|
||
TEST(LibLogUnitTest, test_truth) { | ||
ASSERT_TRUE(1 == 1); | ||
} | ||
|
||
} // namespace Logging | ||
} // namespace Everest |