Skip to content

Commit

Permalink
migrate to github actions, fix credo warnings (#48)
Browse files Browse the repository at this point in the history
* migrate to github actions

* fix credo

* fix dialyzer
  • Loading branch information
ayrat555 authored Oct 17, 2022
1 parent 6962a5a commit eb384fb
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 75 deletions.
49 changes: 0 additions & 49 deletions .circleci/config.yml

This file was deleted.

16 changes: 6 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
version: 2
updates:
- package-ecosystem: mix
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
- package-ecosystem: "mix"
directory: "/"
open-pull-requests-limit: 30
schedule:
interval: "daily"
time: "03:37" # UTC
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: ci

on:
push:
branches:
- master
pull_request:

jobs:
ci:
env:
MIX_ENV: test
strategy:
fail-fast: false
matrix:
include:
- pair:
elixir: '1.14'
otp: '24.3'
lint: lint
- pair:
elixir: '1.14'
otp: '25.0'
lint: lint

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}

- uses: actions/cache@v2
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-
- name: Run mix deps.get
run: mix deps.get --only test

- name: Run mix format
run: mix format --check-formatted
if: ${{ matrix.lint }}

- name: Run mix deps.compile
run: mix deps.compile

- name: Run mix compile
run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}

- name: Run credo
run: mix credo --strict
if: ${{ matrix.lint }}

- name: Run mix test
run: mix test

- name: Run dialyzer
run: mix dialyzer
if: ${{ matrix.lint }}
3 changes: 2 additions & 1 deletion lib/ex_rlp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ defmodule ExRLP do
Elixir implementation of Ethereum's RLP (Recursive Length Prefix) encoding.
"""

alias ExRLP.{Encode, Decode}
alias ExRLP.Decode
alias ExRLP.Encode

@type t :: any()

Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule ExRLP.Mixfile do
package: package(),
deps: deps(),
docs: docs(),
dialyzer: [ignore_warnings: ".dialyzer.ignore-warnings"],
dialyzer: [ignore_warnings: ".dialyzer.ignore-warnings", plt_add_apps: [:jason]],
elixirc_paths: elixirc_paths(Mix.env())
]
end
Expand All @@ -27,7 +27,7 @@ defmodule ExRLP.Mixfile do
[
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:dialyxir, "~> 1.1", only: [:dev], runtime: false},
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
{:jason, "~> 1.3", only: [:dev, :test], runtime: false},
{:propcheck, "~> 1.4", only: [:test]}
]
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"},
"dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"},
"earmark_parser": {:hex, :earmark_parser, "1.4.26", "f4291134583f373c7d8755566122908eb9662df4c4b63caa66a0eabe06569b0a", [:mix], [], "hexpm", "48d460899f8a0c52c5470676611c01f64f3337bad0b26ddab43648428d94aabc"},
"earmark_parser": {:hex, :earmark_parser, "1.4.28", "0bf6546eb7cd6185ae086cbc5d20cd6dbb4b428aad14c02c49f7b554484b4586", [:mix], [], "hexpm", "501cef12286a3231dc80c81352a9453decf9586977f917a96e619293132743fb"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.28.5", "3e52a6d2130ce74d096859e477b97080c156d0926701c13870a4e1f752363279", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "d2c4b07133113e9aa3e9ba27efb9088ba900e9e51caa383919676afdf09ab181"},
"ex_doc": {:hex, :ex_doc, "0.28.6", "2bbd7a143d3014fc26de9056793e97600ae8978af2ced82c2575f130b7c0d7d7", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bca1441614654710ba37a0e173079273d619f9160cbcc8cd04e6bd59f1ad0e29"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
"libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"},
Expand Down
2 changes: 1 addition & 1 deletion test/ex_rlp/performance_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule ExRLP.PerformanceTest do
assert elapsed(start) < 20
end

defp time_start() do
defp time_start do
Time.utc_now()
end

Expand Down
10 changes: 4 additions & 6 deletions test/ex_rlp/property_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ defmodule ExRLP.PropTest do
use PropCheck
use ExUnit.Case

@moduletag timeout: 120_000
@moduletag timeout: 300_000

def safe_decode(binary) do
try do
ExRLP.decode(binary)
rescue
_ -> :decoder_crashed
end
ExRLP.decode(binary)
rescue
_ -> :decoder_crashed
end

# Looks for cases where decoding is not one-to-one. Note: no claims about the encoder are checked here!
Expand Down
2 changes: 1 addition & 1 deletion test/support/log_entry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule ExRLP.LogEntry do
defstruct address: nil, topics: [], data: nil

@type t :: %__MODULE__{
address: EVM.address(),
address: binary(),
topics: [integer()],
data: binary()
}
Expand Down
7 changes: 4 additions & 3 deletions test/support/test_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ defmodule ExRLP.TestUtils do
@tests_directory "test/support/ethereum_common_tests/RLPTests/"

def read_json_file(file_name) do
{:ok, body} = File.read(@tests_directory <> file_name)

Jason.decode!(body)
@tests_directory
|> Kernel.<>(file_name)
|> File.read!()
|> Jason.decode!()
end

def normalize_data("#" <> number) do
Expand Down

0 comments on commit eb384fb

Please sign in to comment.