This commit is contained in:
Andrey Fadeev 2018-08-13 19:49:31 +03:00
commit 85abf0f73f
No known key found for this signature in database
GPG Key ID: 7929305440AF7EF5
9 changed files with 301 additions and 0 deletions

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
# general
log
/_build/
*~
erl_crash.dump
.tags*
*.sublime-workspace
.DS_Store
# builtils
docker-compose.yml
src/dmt_client_*_thrift.erl
include/dmt_client_*_thrift.hrl

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "builtils"]
path = builtils
url = git@github.com:rbkmoney/build_utils.git

48
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,48 @@
#!groovy
// -*- mode: groovy -*-
def finalHook = {
runStage('store CT logs') {
archive '_build/test/logs/'
}
}
build('dmt_client', 'docker-host', finalHook) {
checkoutRepo()
runStage('load_builtils') {
withGithubSshCredentials {
sh 'git submodule update --init'
}
}
def pipeDefault
def withWsCache
runStage('load pipeline') {
env.JENKINS_LIB = "builtils/jenkins_lib"
pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy")
withWsCache = load("${env.JENKINS_LIB}/withWsCache.groovy")
}
pipeDefault() {
runStage('compile') {
withGithubPrivkey {
sh 'make wc_compile'
}
}
runStage('lint') {
sh 'make wc_lint'
}
runStage('xref') {
sh 'make wc_xref'
}
runStage('dialyze') {
withWsCache("_build/default/rebar3_19.1_plt") {
sh 'make wc_dialyze'
}
}
runStage('test') {
sh "make wdeps_test"
}
}
}

52
Makefile Normal file
View File

@ -0,0 +1,52 @@
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
SUBMODULES = builtils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
UTILS_PATH := builtils
TEMPLATES_PATH := .
# Name of the service
SERVICE_NAME := dmt_client
# Build image tag to be used
BUILD_IMAGE_TAG := 9d4d70317dd08abd400798932a231798ee254a87
CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze clean distclean
CALL_W_CONTAINER := $(CALL_ANYWHERE) test
all: compile
-include $(UTILS_PATH)/make_lib/utils_container.mk
.PHONY: $(CALL_W_CONTAINER)
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
submodules: $(SUBTARGETS)
rebar-update:
$(REBAR) update
compile: submodules rebar-update
$(REBAR) compile
xref: submodules
$(REBAR) xref
lint:
elvis rock
dialyze: submodules
$(REBAR) dialyzer
test: submodules
$(REBAR) ct
clean:
$(REBAR) clean
distclean:
$(REBAR) clean -a
rm -rfv _build _builds _cache _steps _temp

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Party management client
Клиент для сервиса PartyManagement. Спецификацию смотри в rbkmoney/damsel в proto/payment_processing.thrift

21
config/sys.config Normal file
View File

@ -0,0 +1,21 @@
[
{party_client, [
{service_urls, #{
}}
]},
{scoper, [
{storage, scoper_storage_lager}
]},
{lager, [
{error_logger_hwm, 600},
{log_root, "/var/log/party_client"},
{crash_log, "crash.log"},
{handlers, [
{lager_file_backend, [
{file, "console.json"},
{level, debug},
{formatter, lager_logstash_formatter}
]}
]}
]}
].

36
docker-compose.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
cat <<EOF
version: '2.1'
services:
${SERVICE_NAME}:
image: ${BUILD_IMAGE}
volumes:
- .:$PWD
- $HOME/.cache:/home/$UNAME/.cache
working_dir: $PWD
command: /sbin/init
depends_on:
dominant:
condition: service_healthy
dominant:
image: dr.rbkmoney.com/rbkmoney/dominant:2c4c8aef2de8b55dfe6ea43e919b967ca649d98d
command: /opt/dominant/bin/dominant foreground
depends_on:
machinegun:
condition: service_healthy
healthcheck:
test: "curl http://localhost:8022/"
interval: 5s
timeout: 1s
retries: 12
machinegun:
image: dr.rbkmoney.com/rbkmoney/machinegun:27df9e276102d5c9faf8d1121374c7355d8e2d1b
command: /opt/machinegun/bin/machinegun foreground
volumes:
- ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml
healthcheck:
test: "curl http://localhost:8022/"
interval: 5s
timeout: 1s
retries: 12
EOF

57
elvis.config Normal file
View File

@ -0,0 +1,57 @@
[
{elvis, [
{config, [
#{
dirs => ["src", "test"],
filter => "*.erl",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 30}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [elvis]}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style, module_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$"}},
{elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 15}},
{elvis_style, no_debug_call, #{ignore => [elvis, elvis_utils]}}
]
},
#{
dirs => ["."],
filter => "Makefile",
ruleset => makefiles
},
#{
dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config
},
#{
dirs => ["."],
filter => "rebar.config",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace}
]
},
#{
dirs => ["src"],
filter => "*.app.src",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace}
]
}
]}
]}
].

67
rebar.config Normal file
View File

@ -0,0 +1,67 @@
%% Common project erlang options.
{erl_opts, [
{parse_transform, lager_transform},
% mandatory
debug_info,
warnings_as_errors,
warn_export_all,
warn_missing_spec,
warn_untyped_record,
warn_export_vars,
% by default
warn_unused_record,
warn_bif_clash,
warn_obsolete_guard,
warn_unused_vars,
warn_shadow_vars,
warn_unused_import,
warn_unused_function,
warn_deprecated_function
% at will
% bin_opt_info
% no_auto_import
% warn_missing_spec_all
]}.
%% Common project dependencies.
{deps, [
{woody , {git, "git@github.com:rbkmoney/woody_erlang.git", {branch, "master"}}},
{lager , "3.2.1"}
]}.
%% XRef checks
{xref_checks, [
undefined_function_calls,
undefined_functions,
deprecated_functions_calls,
deprecated_functions
]}.
% at will
% {xref_warnings, true}.
%% Tests
{cover_enabled, true}.
%% Dialyzer static analyzing
{dialyzer, [
{warnings, [
% mandatory
unmatched_returns,
error_handling,
race_conditions,
unknown
]},
{plt_apps, all_deps}
]}.
{plugins, [
]}.
{pre_hooks, [
{thrift, "git submodule update --init"}
]}.