Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
npoltorapavlo committed Jun 29, 2024
0 parents commit 7e91160
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/L0.yml
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# tdd
22 changes: 22 additions & 0 deletions l0test/CMakeLists.txt
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)
11 changes: 11 additions & 0 deletions l0test/Test.cpp
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));
}

0 comments on commit 7e91160

Please sign in to comment.