-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7e91160
Showing
4 changed files
with
89 additions
and
0 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,55 @@ | ||
name: L0 | ||
|
||
on: | ||
push: | ||
paths: | ||
- l0test/** | ||
pull_request: | ||
paths: | ||
- l0test/** | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{github.repository}} | ||
|
||
- name: Install valgrind, coverage, cmake | ||
run: | | ||
sudo apt update | ||
sudo apt install -y valgrind lcov cmake | ||
- name: Build | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
cmake -S ${GITHUB_REPOSITORY}/l0test -B build/l0test -DCMAKE_INSTALL_PREFIX="install" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror" | ||
cmake --build build/l0test --target install | ||
- name: Run | ||
working-directory: ${{github.workspace}} | ||
run: PATH=${PWD}/install/bin:${PATH} LD_LIBRARY_PATH=${PWD}/install/lib:${LD_LIBRARY_PATH} valgrind --tool=memcheck --log-file=valgrind_log --leak-check=yes --show-reachable=yes --track-fds=yes --fair-sched=try l0test | ||
|
||
- name: Generate coverage | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
lcov -c -o coverage.info -d build/l0test | ||
genhtml -o coverage coverage.info | ||
- name: Upload artifacts | ||
if: ${{ !env.ACT }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: | | ||
coverage/ | ||
valgrind_log | ||
if-no-files-found: warn | ||
|
||
# Usage: | ||
# curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash | ||
# sudo apt update | ||
# sudo apt -y install docker.io | ||
# sudo bin/act -W .github/workflows/L0.yml -s GITHUB_TOKEN=your-PAT |
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 @@ | ||
# tdd |
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 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(l0test) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip | ||
) | ||
FetchContent_MakeAvailable(googletest) | ||
|
||
add_executable(${PROJECT_NAME} | ||
Test.cpp | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
gmock_main | ||
) | ||
|
||
install(TARGETS ${PROJECT_NAME} DESTINATION bin) |
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,11 @@ | ||
#include <gmock/gmock.h> | ||
#include <gtest/gtest.h> | ||
|
||
using ::testing::Eq; | ||
using ::testing::IsTrue; | ||
|
||
TEST(A, B) | ||
{ | ||
ASSERT_THAT(true, IsTrue()); | ||
EXPECT_THAT(0, Eq(0)); | ||
} |