Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync server #5

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0c2b8a4
primary layout
ygimm Oct 18, 2022
6fd178e
Added unit test support.
ivan12093 Oct 18, 2022
fbf17ba
Added coverage scripts and test env.
ivan12093 Oct 20, 2022
988a8cc
deleted submodule.
ivan12093 Oct 20, 2022
d1d3e69
added submodule.
ivan12093 Oct 20, 2022
b630793
add ci and linters
ilyaaid Oct 22, 2022
73ee087
ci correction
ilyaaid Oct 22, 2022
9ef17ff
ci correction 2
ilyaaid Oct 22, 2022
d4b9ad0
allowed execution sh
ilyaaid Oct 22, 2022
709857a
ci correction 3
ilyaaid Oct 22, 2022
d58e2a5
fix makefile
ilyaaid Oct 22, 2022
a5b3294
add gtest to dockerfile
ilyaaid Oct 25, 2022
1ec1974
change container in ci
ilyaaid Oct 25, 2022
534de82
add .dockerignore
ilyaaid Oct 25, 2022
e98944f
update dockerfile
ilyaaid Oct 25, 2022
6bb67c2
Removed submodule and add coverage workflow.
ivan12093 Oct 28, 2022
c92b28a
Resolved issue in workflow.
ivan12093 Oct 28, 2022
b6a7f25
Resolved issue in workflow.
ivan12093 Oct 28, 2022
22aa92e
auto commit coverage report
github-actions[bot] Oct 28, 2022
7639397
added artifact.
ivan12093 Oct 28, 2022
f0c5fde
Merge branch 'dz1_ci' of github.com:cpp-park-vk-education/2022_2_cash…
ivan12093 Oct 28, 2022
a471659
fixed workflow.
ivan12093 Oct 28, 2022
b437f34
fixed workflow.
ivan12093 Oct 28, 2022
80fabee
add lcov to project image
ilyaaid Oct 28, 2022
c683b4c
server code frame & uml
ygimm Nov 21, 2022
174f75a
auto commit coverage report
github-actions[bot] Nov 21, 2022
9b0663c
rooms w/o sync impl
ygimm Dec 6, 2022
89c0f1f
updated project structure
ygimm Dec 6, 2022
cf6e113
merge auto commit
ygimm Dec 6, 2022
a6ea2bd
handlers impl start
ygimm Dec 8, 2022
26217de
basic api done
ygimm Dec 10, 2022
a04d3aa
simple timing check
ygimm Dec 11, 2022
6cbd293
dz#6
ygimm Dec 12, 2022
70b3cc1
ready to present
ygimm Dec 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake-build-debug/
cmake-build-wsl/
.idea/
build/
Dockerfile
.git
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on: push

jobs:
check:
runs-on: ubuntu-latest
container: ilyaaid/watch_up
steps:
- uses: actions/checkout@v3
- run: make check

build:
runs-on: ubuntu-latest
container: ilyaaid/watch_up
steps:
- uses: actions/checkout@v3
- run: make build

test:
runs-on: ubuntu-latest
container: ilyaaid/watch_up
steps:
- uses: actions/checkout@v3
- run: make test

coverage:
runs-on: ubuntu-latest
container: ilyaaid/watch_up
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory /__w/2022_2_cash_map/2022_2_cash_map
- run: git submodule update --init
- run: make coverage
- run: gcovr -r . -s | sed '/tests/d' | sed '/server/d' > client/README.txt
- run: gcovr -r . -s | sed '/tests/d' | sed '/client/d' > server/README.txt
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git config --global user.name "github-actions[bot]"
- run: git add client/README.txt server/README.txt
- run: git commit -m "auto commit coverage report" && git push || echo "coverage not changed."
- uses: actions/upload-artifact@v3
with:
name: coverage-report
path: build/lcov/html
retention-days: 5
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake-build-debug/
cmake-build-docker/
cmake-build-wsl/
cmake-build-mingw/
.idea/
build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "externals/CMake-codecov"]
path = externals/CMake-codecov
url = https://github.com/ivan12093/CMake-codecov.git
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
cmake_minimum_required(VERSION 3.18)

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.314.tar.gz"
SHA1 "95c47c92f68edb091b5d6d18924baabe02a6962a"
)

project(watch_up_project)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(BUILD_TESTS "Build tests" ON)
option(BUILD_DOCS "Build documentation" OFF)
option(BUILD_COVERAGE "Build code coverage" OFF)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Werror -Wall -Wextra")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wnon-virtual-dtor")

find_package(GTest CONFIG)
if (NOT GTest_FOUND)
hunter_add_package(GTest)
endif()
find_package(GTest CONFIG REQUIRED)

if (BUILD_TESTS)
include(GoogleTest)
enable_testing()
endif()

if (BUILD_COVERAGE)
set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/CMake-codecov/cmake")
find_package(codecov)
string(APPEND CMAKE_CXX_FLAGS " --coverage")
endif()

add_subdirectory(server)
add_subdirectory(client)

if (BUILD_COVERAGE)
coverage_evaluate()
endif()
8 changes: 8 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
headers=h,hpp
linelength=110
filter=-whitespace/tab
filter=-runtime/int
filter=-legal/copyright
filter=-build/include_subdir
filter=-build/include
filter=-readability/casting
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu
ENV DEBIAN_FRONTEND noninteractive
WORKDIR cash_map
COPY . .
RUN apt -y update && \
apt -y install python3 cppcheck clang-tidy make git lcov \
gcovr python3-pip libgtest-dev build-essential gcc g++ gdb clang cmake && \
pip3 install cpplint && \
pip3 install --upgrade cmake && \
apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: all build rebuild check test testextra memtest memtestextra clean coverage

all: clean check build test coverage

clean:
rm -rf build

check:
cd scripts && chmod +x run_linters.sh && ./run_linters.sh

build:
cd scripts && chmod +x build.sh && ./build.sh

test: build
cd scripts && chmod +x run_tests.sh && ./run_tests.sh

coverage:
cd scripts && chmod +x coverage.sh && ./coverage.sh
24 changes: 24 additions & 0 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
project(client)

file(GLOB SOURCES "src/*.cpp")

list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/client.cpp")

add_library(${PROJECT_NAME}_lib STATIC ${SOURCES})

target_include_directories(${PROJECT_NAME}_lib PUBLIC include)

add_executable(${PROJECT_NAME} ./src/client.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC include)

target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib)

if (BUILD_TESTS)
add_subdirectory(tests)
endif()

if (BUILD_COVERAGE)
add_coverage(${PROJECT_NAME})
add_coverage(${PROJECT_NAME}_lib)
endif()
13 changes: 13 additions & 0 deletions client/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
------------------------------------------------------------------------------
GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File Lines Exec Cover Missing
------------------------------------------------------------------------------
client/src/client.cpp 5 0 0% 5-9
client/src/lib.cpp 2 2 100%
------------------------------------------------------------------------------
TOTAL 21 9 42%
------------------------------------------------------------------------------
lines: 42.9% (9 out of 21)
branches: 18.4% (7 out of 38)
5 changes: 5 additions & 0 deletions client/include/lib.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include <string>

std::string foo();
10 changes: 10 additions & 0 deletions client/src/client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <iostream>

#include "lib.hpp"

int main() {
std::cout << "Client exe" << "\n";
std::cout << foo() << "\n";
for (int i = 1; i < 2; ++i) {}
return 0;
}
7 changes: 7 additions & 0 deletions client/src/lib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <string>

#include "lib.hpp"

std::string foo() {
return "Foo lib";
}
11 changes: 11 additions & 0 deletions client/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
project(test_client)

file(GLOB TEST_SOURCES "*.cpp")

add_executable(${PROJECT_NAME} ${TEST_SOURCES})

target_link_libraries(${PROJECT_NAME} client_lib GTest::gtest_main)

#add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
gtest_discover_tests(${PROJECT_NAME})

9 changes: 9 additions & 0 deletions client/tests/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <gtest/gtest.h>
#include <string>

#include "lib.hpp"

TEST(Lib_test, test_foo) {
std::string a = "Foo lib";
EXPECT_EQ(a, foo());
}
Loading