Skip to content

Commit bb365b8

Browse files
authored
Make realmedium ready to show (#11)
1 parent d1cf70f commit bb365b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+430
-817
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
name: CI
1+
name: urealmedium CI
22

33
'on':
4+
schedule:
5+
- cron: '30 5 * * 1' # Every Monday at 5:30
46
pull_request:
57
push:
68
branches:
@@ -42,16 +44,15 @@ jobs:
4244
4345
- name: Install packages
4446
run: |
47+
(cd third_party && git clone -b develop --single-branch --depth 1 https://github.com/userver-framework/userver.git)
4548
sudo apt update
46-
sudo apt install --allow-downgrades -y postgresql $(cat third_party/userver/scripts/docs/en/deps/${{matrix.os}}.md | tr '\n' ' ')
47-
sudo apt install --allow-downgrades -y pep8 $(cat third_party/userver/scripts/docs/en/deps/${{matrix.os}}.md | tr '\n' ' ')
49+
sudo apt install --allow-downgrades -y pycodestyle postgresql $(cat third_party/userver/scripts/docs/en/deps/${{matrix.os}}.md | tr '\n' ' ')
4850
4951
- name: Reinstall postgres 14
5052
run: |
5153
sudo apt purge libpq5 libpq-dev postgresql-*
5254
sudo apt install -y postgresql-14 postgresql-client-14 postgresql-server-dev-14
5355
54-
5556
- name: Setup ccache
5657
run: |
5758
ccache -M 2.0GB
@@ -81,11 +82,11 @@ jobs:
8182
8283
- name: Test run after install
8384
if: matrix.make == 'test-release'
84-
run: >-
85-
./local_installation/bin/realmedium_sample
86-
--config=./local_installation/etc/realmedium_sample/static_config.yaml
87-
--config_vars=./local_installation/etc/realmedium_sample/config_vars.yaml
88-
&
85+
run: |
86+
./local_installation/bin/realmedium_sample \
87+
--config=./local_installation/etc/realmedium_sample/config.yaml \
88+
--config_vars=./local_installation/etc/realmedium_sample/config_vars.yaml \
89+
&
8990
9091
- name: Check work run service
9192
if: matrix.make == 'test-release'

.github/workflows/docker.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
name: Docker build
1+
name: urealmedium Docker build
22

33
'on':
4+
schedule:
5+
- cron: '30 5 * * 1' # Every Monday at 5:30
46
pull_request:
57
push:
68
branches:
@@ -15,12 +17,12 @@ jobs:
1517
tests:
1618
runs-on: ubuntu-latest
1719
steps:
18-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
1921
with:
2022
submodules: true
2123

2224
- name: Reuse ccache directory
23-
uses: actions/cache@v2
25+
uses: actions/cache@v4
2426
with:
2527
path: .ccache
2628
key: 'ccache-dir-${{github.ref}}_run-${{github.run_number}}'

.github/workflows/update-submodules.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "third_party/userver"]
2-
path = third_party/userver
3-
url = https://github.com/userver-framework/userver.git
41
[submodule "third_party/cpp-jwt"]
52
path = third_party/cpp-jwt
63
url = https://github.com/arun11299/cpp-jwt

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ add_library(${PROJECT_NAME}_objs OBJECT
3737
src/cache/articles_cache.cpp
3838
src/cache/comments_cache.cpp
3939
src/cache/comments_cache.hpp
40+
src/handlers/common.cpp
41+
src/handlers/common.hpp
4042
src/handlers/profiles/profiles.cpp
4143
src/handlers/profiles/profiles.hpp
4244
src/handlers/users/users.cpp
@@ -80,15 +82,13 @@ add_library(${PROJECT_NAME}_objs OBJECT
8082
src/dto/comment.hpp
8183
src/dto/comment.cpp
8284
src/db/sql.hpp
83-
src/db/types.hpp
8485
src/models/user.hpp
8586
src/models/user.cpp
8687
src/models/comment.hpp
8788
src/models/comment.cpp
8889
src/models/article.hpp
8990
src/models/article.cpp
9091
src/models/profile.hpp
91-
src/models/profile.cpp
9292
src/validators/user_validators.hpp
9393
src/validators/user_validators.cpp
9494
src/validators/length_validator.hpp
@@ -118,10 +118,8 @@ target_link_libraries(${PROJECT_NAME}_objs PUBLIC userver::core userver::postgre
118118

119119
file(GLOB_RECURSE SCHEMAS ${CMAKE_CURRENT_SOURCE_DIR}/docs/*.yaml)
120120
userver_target_generate_chaotic(${PROJECT_NAME}-chgen
121-
ARGS
122-
-n "/components/schemas/([^/]*)/=real_medium::handlers::{0}"
123-
-f "(.*)={0}"
124-
--generate-serializers
121+
LAYOUT "/components/schemas/([^/]*)/=real_medium::handlers::{0}"
122+
GENERATE_SERIALIZERS
125123
OUTPUT_DIR
126124
${CMAKE_CURRENT_BINARY_DIR}/src
127125
SCHEMAS
@@ -153,7 +151,9 @@ target_link_libraries(${PROJECT_NAME}_unittest PRIVATE ${PROJECT_NAME}_objs user
153151
add_google_tests(${PROJECT_NAME}_unittest)
154152

155153
# Functional Tests
156-
add_subdirectory(tests)
154+
userver_testsuite_add_simple(
155+
REQUIREMENTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/requirements.txt
156+
)
157157

158158
# Install
159159
include(GNUInstallDirs)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CMAKE_COMMON_FLAGS ?= -DUSERVER_OPEN_SOURCE_BUILD=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
1+
CMAKE_COMMON_FLAGS ?= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
22
CMAKE_DEBUG_FLAGS ?= -DUSERVER_SANITIZE='addr ub'
33
CMAKE_RELEASE_FLAGS ?=
44
CMAKE_OS_FLAGS ?= -DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 -DUSERVER_FEATURE_REDIS_HI_MALLOC=1

Makefile.local

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# RealMedium
22

3-
## THIS SAMPLE IS NOT READY! COME BACK LATER
3+
[![urealmedium CI](https://github.com/userver-framework/realmedium_sample/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/userver-framework/realmedium_sample/actions/workflows/ci.yml)
4+
[![urealmedium Docker build](https://github.com/userver-framework/realmedium_sample/actions/workflows/docker.yaml/badge.svg?branch=develop)](https://github.com/userver-framework/realmedium_sample/actions/workflows/docker.yaml)
45

56
This is project created in summer school Yandex.
67
This codebase was created to demonstrate a fully fledged backend application built with **[userver framework](https://userver.tech/)**
78

9+
### Prerequisites
10+
11+
[Install the userver](https://userver.tech/de/dab/md_en_2userver_2build_2build.html#ways_to_get_userver) into the system
12+
or
13+
* check it out `git clone --depth 1 https://github.com/userver-framework/userver.git /path/to/userver`
14+
* install all of its dependencies
15+
* `ln -s /path/to/userver /path/to/realmedioum_sample/third_party/userver`
16+
817
### Docker-compose
918
```
1019
# Clone submodules
@@ -13,16 +22,20 @@ git submodule update --init
1322
# Run service
1423
make docker-start-service-release
1524
```
25+
1626
### Local
1727
```
1828
make service-start-release
1929
```
30+
2031
## Tests
2132
Run unit and functional tests in docker or local.
33+
2234
### Docker-compose
2335
```
2436
make docker-test-release
2537
```
38+
2639
### Local
2740
```
2841
make test-release
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)