Skip to content

Commit

Permalink
chore: add ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
oltarasenko committed Dec 6, 2024
1 parent b0686e4 commit 7cab106
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: HyperBEAM CI

on:
push:
branches:
- 'main' # Trigger action for merges to main
pull_request:
branches:
- 'main' # Trigger action for pushes to all PRs to main

jobs:
build:
runs-on: ubuntu-latest # Use the latest Ubuntu runner

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache rebar3 dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/rebar3
_build
key: ci-${{ runner.os }}-rebar3-${{ hashFiles('rebar.lock') }}
restore-keys: |
ci-${{ runner.os }}-rebar3
- name: Set up Erlang
uses: erlef/setup-beam@v1
with:
otp-version: '27.0'
rebar3-version: '3.24.0'

- name: Install dependencies
run: rebar3 get-deps

- name: Compile
run: rebar3 compile

- name: Run tests
run: rebar3 eunit
timeout-minutes: 5
7 changes: 5 additions & 2 deletions src/hb_cache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ composite_unsigned_item_test() ->
).

%% Test storing and retrieving a composite signed item
composite_signed_item_test() ->
test_composite_signed_item() ->
ItemData = #{
<<"key1">> => create_signed_tx(<<"value1">>),
<<"key2">> => create_signed_tx(<<"value2">>)
Expand Down Expand Up @@ -488,4 +488,7 @@ latest_output_retrieval_test() ->
ok = write_output(Store, fmt_id(Proc, signed), 0, Item1),
ok = write_output(Store, fmt_id(Proc, signed), 1, Item2),
?assertEqual({1, Item2}, latest(Store, fmt_id(Proc, signed))),
?assertEqual({0, Item1}, latest(Store, fmt_id(Proc, signed), 0)).
?assertEqual({0, Item1}, latest(Store, fmt_id(Proc, signed), 0)).

slow_test_() ->
[{timeout, 30, fun test_composite_signed_item/0}].

0 comments on commit 7cab106

Please sign in to comment.