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

Change woody.error-reason missing message to be more readable #1

Merged
merged 40 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4954bd4
change woody.error-reason missing message to be more readable
kehitt Jan 14, 2022
e372d86
switch to forked deps, employ actions for CI
kehitt Jan 14, 2022
f947d71
lint with rebar3 lint
kehitt Jan 14, 2022
6199ab4
fix elvis, update workflow
kehitt Jan 17, 2022
1a17cca
fix workflow branches
kehitt Jan 17, 2022
504951f
fix workflow step typo
kehitt Jan 17, 2022
187315d
fix workflow thrift dep
kehitt Jan 17, 2022
b43e710
once more
kehitt Jan 17, 2022
bbd4d65
fix
kehitt Jan 17, 2022
7df8f5b
test
kehitt Jan 17, 2022
f3d1008
roll back test deps, change error message again, fix workflow
kehitt Jan 17, 2022
5afa481
revert thift compiler install step
kehitt Jan 17, 2022
57f6b23
try running multi-achitecture
kehitt Jan 17, 2022
e7dc68d
fix workflow matrix
kehitt Jan 17, 2022
a2bafa3
drop container from ci
kehitt Jan 17, 2022
21c7d6f
fix cache
kehitt Jan 17, 2022
c0a686d
break ct as a test
kehitt Jan 17, 2022
46614c0
break the break
kehitt Jan 17, 2022
fcb6ac2
fix wrong plt
kehitt Jan 17, 2022
b9bb9a0
unbreak tests
kehitt Jan 17, 2022
bb55a88
experimental multi-job CI
kehitt Jan 18, 2022
8a061f0
fix
kehitt Jan 18, 2022
177336f
separate deps cache step
kehitt Jan 18, 2022
29da4da
fix skip step
kehitt Jan 18, 2022
b611a86
add try adding coverage
kehitt Jan 18, 2022
d4d034f
more universal cover filename
kehitt Jan 18, 2022
a6991b3
configure codecov limits
kehitt Jan 18, 2022
39a1e35
move config to the correct folder
kehitt Jan 18, 2022
60e9bd2
experimental cache _build
kehitt Jan 19, 2022
8d9f500
anchors away
kehitt Jan 19, 2022
5d25618
fix thrift compiler plugin to tag, lock build cache completely
kehitt Jan 19, 2022
d8a1d87
experimental reusable workflow
kehitt Jan 19, 2022
608c97b
nah
kehitt Jan 19, 2022
6c0c9e7
revert to nonreusable
kehitt Jan 19, 2022
ba7ef08
fix ct log upload
kehitt Jan 19, 2022
8a7e70b
review fixes
kehitt Jan 20, 2022
50a7000
don't cache the base plt
kehitt Jan 20, 2022
295dc0e
dont need to rerun rebar3 cover if tests are run with --cover
kehitt Jan 20, 2022
77dee60
bring back the otp version
kehitt Jan 20, 2022
e10dfdd
remove rebar.lock wildcard
kehitt Jan 21, 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
11 changes: 11 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage:
status:
project:
default:
# Allow total coverage to drop by at most 2%
target: auto
threshold: 2%
patch:
default:
# Force any given PR to be at least 70% covered
target: 70%
164 changes: 164 additions & 0 deletions .github/workflows/erlang-library.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Erlang library CI
keynslug marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [ master ]
pull_request:
branches: [ '**' ]

env:
OTP_VERSION: 24.2
REBAR_VERSION: 3.18
THRIFT_VERSION: 0.14.2

jobs:
deps:
name: Cache dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}

- name: Cache Hex packages
id: hex_cache
uses: actions/cache@v2
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-${{ hashFiles('**/rebar.config') }}
keynslug marked this conversation as resolved.
Show resolved Hide resolved
keynslug marked this conversation as resolved.
Show resolved Hide resolved
keynslug marked this conversation as resolved.
Show resolved Hide resolved
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-

- name: Get dependencies
if: ${{ steps.hex_cache.outputs.cache-hit != 'true' }}
keynslug marked this conversation as resolved.
Show resolved Hide resolved
run: rebar3 deps

build:
name: Build / Check
runs-on: ubuntu-latest
needs: deps
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Thrift compiler
uses: valitydev/action-setup-thrift@v0.0.4
with:
thrift-version: ${{ env.THRIFT_VERSION }}

- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}

- name: Cache Hex packages
uses: actions/cache@v2
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-${{ hashFiles('**/rebar.config') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-
keynslug marked this conversation as resolved.
Show resolved Hide resolved

- name: Compile
run: make compile

- name: Check formatting
run: make check_format

- name: Run linting
run: make lint

- name: Run xref
run: make xref

analyze:
name: Dialyze
needs: deps
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Thrift compiler
uses: valitydev/action-setup-thrift@v0.0.4
with:
thrift-version: ${{ env.THRIFT_VERSION }}

- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}

- name: Cache Hex packages
uses: actions/cache@v2
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-${{ hashFiles('**/rebar.config') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-

- name: Cache PLTs
uses: actions/cache@v2
with:
path: |
~/.cache/rebar3/rebar3_*_plt
_build/test/rebar3_*_plt
keynslug marked this conversation as resolved.
Show resolved Hide resolved
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-plt-${{ hashFiles('**/rebar.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-plt-

- name: Run dialyzer
run: make dialyze

test:
name: Test
needs: deps
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Thrift compiler
uses: valitydev/action-setup-thrift@v0.0.4
with:
thrift-version: ${{ env.THRIFT_VERSION }}

- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}

- name: Cache Hex packages
uses: actions/cache@v2
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-${{ hashFiles('**/rebar.config') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-hex-

- name: Run tests
id: run_tests
run: make test

- name: Store CT Logs
if: ${{ steps.run_tests.outcome == 'failure' }}
uses: actions/upload-artifact@v2
with:
name: ct-logs
path: _build/test/logs

- name: Run cover analysis
run: make cover

- name: Upload cover stats
uses: codecov/codecov-action@v2
with:
files: _build/test/covertool/*.covertool.xml
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

42 changes: 0 additions & 42 deletions Jenkinsfile

This file was deleted.

40 changes: 10 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,19 @@
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
SUBMODULES = build_utils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))

UTILS_PATH := build_utils
# ToDo: remove unused TEMPLATES_PATH here, when the bug
# with handling of the varriable in build_utils is fixed
TEMPLATES_PATH := .
SERVICE_NAME := woody
.PHONY: compile test xref lint check_format format clean distclean dialyze cover bench

BUILD_IMAGE_NAME := build-erlang
BUILD_IMAGE_TAG := c60896ef07d41e7ae2e5f9b6ce845a60ad79acc7

CALL_W_CONTAINER := all submodules compile xref lint test bench dialyze clean distclean \
check_format format

.PHONY: $(CALL_W_CONTAINER)

all: compile

-include $(UTILS_PATH)/make_lib/utils_container.mk

$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@

submodules: $(SUBTARGETS)

compile: submodules
compile:
$(REBAR) compile

test: submodules
test:
$(REBAR) eunit
$(REBAR) ct

xref: submodules
xref:
$(REBAR) xref

lint: compile
elvis rock
lint:
$(REBAR) lint

check_format:
$(REBAR) fmt -c
Expand All @@ -57,6 +33,10 @@ distclean:
dialyze:
$(REBAR) as test dialyzer

cover:
$(REBAR) cover
$(REBAR) covertool generate

bench:
$(REBAR) as test bench -m bench_woody_event_handler -n 1000
$(REBAR) as test bench -m bench_woody_formatter -n 10
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Woody [![Build Status](http://ci.rbkmoney.com/buildStatus/icon?job=rbkmoney_private/woody_erlang/master)](http://ci.rbkmoney.com/job/rbkmoney_private/view/Erlang/job/woody_erlang/job/master/)
Woody
======

Erlang реализация [Библиотеки RPC вызовов для общения между микросервисами](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/)
Erlang реализация [Библиотеки RPC вызовов для общения между микросервисами](#coredocs/design/ms/platform/rpc-lib/)

версия требований: __ac4d40cc22d649d03369fcd52fb1230e51cdf52e__

Expand Down Expand Up @@ -58,7 +58,7 @@ Erlang реализация [Библиотеки RPC вызовов для об

В случае вызова _thrift_ `oneway` функции (_thrift_ реализация _cast_) `woody_client:call/3` вернет `{ok, ok}`.

Если сервер бросает `Exception`, описанный в _.thrift_ файле сервиса (т.е. _Бизнес ошибку_ в [терминологии](http://coredocs.rbkmoney.com/design/ms/platform/overview/#_7) макросервис платформы), `woody_client:call/3` вернет это исключение в виде: `{exception, Exception}`.
Если сервер бросает `Exception`, описанный в _.thrift_ файле сервиса (т.е. _Бизнес ошибку_ в [терминологии](#coredocs/design/ms/platform/overview/#_7) макросервис платформы), `woody_client:call/3` вернет это исключение в виде: `{exception, Exception}`.

В случае получения _Системной_ ошибки клиент выбрасывает _erlang:error_ типа `{woody_error, woody_error:system_error()}`.

Expand All @@ -74,7 +74,7 @@ Erlang реализация [Библиотеки RPC вызовов для об
18> {ok, Result2} = woody_client:call(Request, Opts1, Context2).
```

`Context` позволяет аннотировать RPC запросы дополнительными мета данными в виде _key-value_. `Context` передается только в запросах и изменение мета данных возможно только в режиме _append-only_ (т.е. на попытку переопределить уже существующую запись в `context meta`, библиотека вернет ошибку). Поскольку на транспортном уровне контекст передается в виде custom HTTP заголовков, синтаксис метаданных _key-value_ должен следовать ограничениям [RFC7230 ](https://tools.ietf.org/html/rfc7230#section-3.2.6). Размер ключа записи метаданных не должен превышать _53 байта_ (см. остальные требования к метаданным в [описании библиотеки](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/#rpc_2)).
`Context` позволяет аннотировать RPC запросы дополнительными мета данными в виде _key-value_. `Context` передается только в запросах и изменение мета данных возможно только в режиме _append-only_ (т.е. на попытку переопределить уже существующую запись в `context meta`, библиотека вернет ошибку). Поскольку на транспортном уровне контекст передается в виде custom HTTP заголовков, синтаксис метаданных _key-value_ должен следовать ограничениям [RFC7230 ](https://tools.ietf.org/html/rfc7230#section-3.2.6). Размер ключа записи метаданных не должен превышать _53 байта_ (см. остальные требования к метаданным в [описании библиотеки](#coredocs/design/ms/platform/rpc-lib/#rpc_2)).

```erlang
19> Meta1 = #{<<"client1-name">> => <<"Vasya">>}.
Expand All @@ -87,7 +87,7 @@ Erlang реализация [Библиотеки RPC вызовов для об
26> FullMeta = woody_context:get_meta(Context4).
```

`Context` также позволяет задать [deadline](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/#deadline) на исполнение запроса. Значение _deadline_ вложенных запросов можно менять произвольным образом. Также таймауты на запрос, [вычисляемые по deadline](src/woody_client_thrift_http_transport.erl), можно явно переопределить из приложения через _transport_opts_ в `woody_client:options()`. Модуль [woody_deadline](src/woody_deadline.erl) содержит API для работы с deadline.
`Context` также позволяет задать [deadline](#coredocs/design/ms/platform/rpc-lib/#deadline) на исполнение запроса. Значение _deadline_ вложенных запросов можно менять произвольным образом. Также таймауты на запрос, [вычисляемые по deadline](src/woody_client_thrift_http_transport.erl), можно явно переопределить из приложения через _transport_opts_ в `woody_client:options()`. Модуль [woody_deadline](src/woody_deadline.erl) содержит API для работы с deadline.

```erlang
27> Deadline = {{{2017, 12, 31}, {23, 59, 59}}, 350}.
Expand Down
1 change: 0 additions & 1 deletion build_utils
Submodule build_utils deleted from e13187
Loading