Skip to content

Commit

Permalink
Github Actions Workflow (#81)
Browse files Browse the repository at this point in the history
* Added pipeline
* Workflow badge

Ignore VSCode sttings

Added specs and documentation to riak_core_claim
+ format

Added some specs and documentation to riak_core_ring (see #78)

Added specs and documentation to riak_core_apl

Added tags to chashbin documentation

Added specs and documentation to riak_core_apl
fixed typo in doc tag in chashbin

Added documentation status: done to reviewed files

Added specs and documentation to riak_core_app

Added documentation status: done to riak_core_app

Added specs and documentation to riak_core

Added specs and documentation to riak_core_claimant

Fixed typo in atom in spec

Added some specs and documentation to riak_core_ring_manager while

Added documentation to riak_core_handoff_listener_sup

Added specs to all handoff supervisors

Added documentation to riak_core_handoff_listener

Added documentation to riak_core_handoff_manager

Documentation for riak_core_handoff_receiver

Added documentation to riak_core_handoff_sender

Added draw.io project cotaining action diagrams of some core functionalities.

Apply suggestions from code review

Removed status of documentation from source files
  • Loading branch information
albsch authored and Albert Schimpf committed Jul 13, 2021
1 parent 3f836ae commit 3244ef3
Show file tree
Hide file tree
Showing 26 changed files with 2,096 additions and 184 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Erlang CI

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

jobs:

build:

runs-on: ubuntu-latest
strategy:
matrix:
erlang: [ 21,22,23 ]

container:
image: erlang:${{ matrix.erlang }}

steps:
- uses: actions/checkout@v2
- name: Compile
run: make compile
- name: Format
run: make format
- name: Unit Tests
run: make test
- name: Property-Based Tests
run: make proper
- name: Coverage
run: make coverage
- name: Lint
run: make lint
- name: XRef
run: make xref
- name: Dialyzer
run: make dialyzer
- name: Documentation
run: make docs
- name: Send Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./rebar3 as test coveralls send
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ rebar3.crashdump
.rebar3/
core_vnode_eqc.log
.idea
.vscode/
*.iml
**/*.coverdata
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Build upon the essence of Riak KV's core with an up-to-date, modular and extensi
![Build](https://img.shields.io/badge/build-rebar3%203.13.0-brightgreen.svg)

[![Hex pm](https://img.shields.io/hexpm/v/riak_core_lite.svg)](https://hex.pm/packages/riak_core_lite)
[![Build Status](https://api.travis-ci.org/riak-core-lite/riak_core_lite.svg?branch=master)](https://api.travis-ci.org/riak-core-lite/riak_core_lite.svg?branch=master)
![Erlang CI](https://github.com/albsch/riak_core_lite/workflows/Erlang%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/riak-core-lite/riak_core_lite/badge.svg?branch=master)](https://coveralls.io/github/riak-core-lite/riak_core_lite?branch=master)


Expand Down
1 change: 1 addition & 0 deletions docs/Diagrams.drawio

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
{profiles, [
{test, [
{erl_opts, [nowarn_export_all]},
{plugins, [{coveralls, {git, "https://github.com/markusn/coveralls-erl", {branch, "master"}}}]},
{plugins, [coveralls]},
{deps, [meck]}
]},
{proper, [
{erl_opts, [nowarn_export_all, {d, 'PROPER'}, {d, 'TEST'}]},
{plugins, [{coveralls, {git, "https://github.com/markusn/coveralls-erl", {branch, "master"}}}]},
{plugins, [coveralls]},
{deps, [meck, {proper, "1.3.0"}, recon]}
]},
{docs, [{deps, [{edown, "0.7.0"}]}]}
]}.



{cover_enabled, true}.
{cover_export_enabled, true}.
{coveralls_coverdata, "_build/test/cover/*.coverdata"}.
{coveralls_service_name, "travis-ci"}.
{coveralls_service_name, "github"}.
22 changes: 16 additions & 6 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
case os:getenv("TRAVIS") of
"true" ->
lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, os:getenv("TRAVIS_JOB_ID")});
_ ->
CONFIG
end.
case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
{"true", Token} when is_list(Token) ->
CONFIG1 = [{coveralls_repo_token, Token},
{coveralls_service_job_id, os:getenv("GITHUB_RUN_ID")},
{coveralls_commit_sha, os:getenv("GITHUB_SHA")},
{coveralls_service_number, os:getenv("GITHUB_RUN_NUMBER")} | CONFIG],
case os:getenv("GITHUB_EVENT_NAME") =:= "pull_request"
andalso string:tokens(os:getenv("GITHUB_REF"), "/") of
[_, "pull", PRNO, _] ->
[{coveralls_service_pull_request, PRNO} | CONFIG1];
_ ->
CONFIG1
end;
_ ->
CONFIG
end.
1 change: 1 addition & 0 deletions src/chash.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

-module(chash).


-export([contains_name/2, fresh/2, lookup/2, key_of/1,
members/1, merge_rings/2, next_index/2, nodes/1,
predecessors/2, predecessors/3, ring_increment/1,
Expand Down
27 changes: 18 additions & 9 deletions src/chashbin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
%% -------------------------------------------------------------------
-module(chashbin).


-export([create/1, to_chash/1, to_list/1,
to_list_filter/2, responsible_index/2,
responsible_position/2, index_owner/2,
Expand Down Expand Up @@ -164,6 +165,16 @@ iterator(HashKey, CHBin) ->
Pos = responsible_position(HashKey, CHBin),
#iterator{pos = Pos, start = Pos, chbin = CHBin}.

%% @doc Return iterator pointing to the given index
-spec exact_iterator(Index :: index() | <<_:160>>,
CHBin :: chashbin()) -> iterator().

exact_iterator(<<Idx:160/integer>>, CHBin) ->
exact_iterator(Idx, CHBin);
exact_iterator(Idx, CHBin) ->
Pos = index_position(Idx, CHBin),
#iterator{pos = Pos, start = Pos, chbin = CHBin}.

%% @doc Return the `{Index, Owner}' pair pointed to by the iterator
-spec itr_value(iterator()) -> {index(), node()}.

Expand Down Expand Up @@ -231,7 +242,8 @@ itr_next_while(Pred, Itr) ->
%% Internal functions
%% ===================================================================

%% Convert list of {Index, Owner} pairs into `chashbin' binary representation
%% @private
%% @doc Convert list of {Index, Owner} pairs into `chashbin' binary representation
-spec create_bin([{index(), node()}],
[{node(), pos_integer()}], binary()) -> owners_bin().

Expand All @@ -241,15 +253,12 @@ create_bin([{Idx, Owner} | Owners], Nodes, Bin) ->
Bin2 = <<Bin/binary, Idx:160/integer, Id:16/integer>>,
create_bin(Owners, Nodes, Bin2).

%% Convert ring index into ring position
%% @private
%% @doc Convert ring index into ring position
-spec index_position(Index :: index() | <<_:160>>,
CHBin :: chashbin()) -> integer().

index_position(<<Idx:160/integer>>, CHBin) ->
index_position(Idx, CHBin);
index_position(Idx, #chashbin{size = Size}) ->
Inc = chash:ring_increment(Size), Idx div Inc rem Size.

%% Return iterator pointing to the given index
exact_iterator(<<Idx:160/integer>>, CHBin) ->
exact_iterator(Idx, CHBin);
exact_iterator(Idx, CHBin) ->
Pos = index_position(Idx, CHBin),
#iterator{pos = Pos, start = Pos, chbin = CHBin}.
13 changes: 6 additions & 7 deletions src/gen_nb_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@
{stop, Reason :: term(),
NewState :: term()}.

%% @spec start_link(Module, IpAddr, Port, InitParams) -> Result
%% Module = atom()
%% IpAddr = string()
%% Port = integer()
%% InitParams = [any()]
%% Result = {ok, pid()} | {error, any()}
%% @doc Start server listening on IpAddr:Port
%% @doc Start server listening on `IpAddr:Port'.
-spec start_link(Module :: atom(), IpAddr :: string(),
Port :: integer(), INitParams :: [any()]) -> {ok,
pid()} |
{error, any()}.

start_link(Module, IpAddr, Port, InitParams) ->
gen_server:start_link(?MODULE,
[Module, IpAddr, Port, InitParams], []).
Expand Down
Loading

0 comments on commit 3244ef3

Please sign in to comment.