diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e881175 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "mix" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..471a9b9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI +on: + pull_request: + push: + +jobs: + main: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + include: + - elixir: '1.17' + erlang: '27.0' + # lint: true / enable once 1.17 stable is released + - elixir: '1.16' + erlang: '26.2.5' + lint: true + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + if: ${{ ! matrix.lint }} + with: + path: | + _build + deps + key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.erlang }}-${{ hashFiles('mix.lock') }} + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ matrix.erlang }} + elixir-version: ${{ matrix.elixir }} + - run: mix deps.get --check-locked + - run: mix format --check-formatted + if: ${{ matrix.lint }} + - run: mix deps.unlock --check-unused + if: ${{ matrix.lint }} + - run: mix compile + if: ${{ ! matrix.lint }} + - run: mix compile --warnings-as-errors + if: ${{ matrix.lint }} + - run: mix test diff --git a/lib/tower_rollbar/rollbar/client.ex b/lib/tower_rollbar/rollbar/client.ex index 6beb307..b1109b9 100644 --- a/lib/tower_rollbar/rollbar/client.ex +++ b/lib/tower_rollbar/rollbar/client.ex @@ -4,20 +4,20 @@ defmodule TowerRollbar.Rollbar.Client do def post(path, payload) when is_map(payload) do case :httpc.request( - :post, - { - ~c"#{@base_url}#{path}", - [{@access_token_header, access_token()}], - ~c"application/json", - Jason.encode!(payload) - }, - [ - ssl: [ - cacerts: :public_key.cacerts_get() - ] - ], - [] - ) do + :post, + { + ~c"#{@base_url}#{path}", + [{@access_token_header, access_token()}], + ~c"application/json", + Jason.encode!(payload) + }, + [ + ssl: [ + cacerts: :public_key.cacerts_get() + ] + ], + [] + ) do {:ok, result} -> result |> IO.inspect() diff --git a/lib/tower_rollbar/rollbar/item.ex b/lib/tower_rollbar/rollbar/item.ex index 7a56584..5719cdd 100644 --- a/lib/tower_rollbar/rollbar/item.ex +++ b/lib/tower_rollbar/rollbar/item.ex @@ -29,15 +29,16 @@ defmodule TowerRollbar.Rollbar.Item do person = Keyword.get(options, :person) %{ - "data" => %{ - "environment" => environment(), - "timestamp" => :os.system_time(:second), - "body" => body - } - |> maybe_put_request_data(plug_conn) - |> maybe_put_level(level) - |> maybe_put_custom(custom) - |> maybe_put_person(person) + "data" => + %{ + "environment" => environment(), + "timestamp" => :os.system_time(:second), + "body" => body + } + |> maybe_put_request_data(plug_conn) + |> maybe_put_level(level) + |> maybe_put_custom(custom) + |> maybe_put_person(person) } end diff --git a/mix.exs b/mix.exs index dfd10fc..9df04bb 100644 --- a/mix.exs +++ b/mix.exs @@ -14,7 +14,7 @@ defmodule TowerRollbar.MixProject do # Run "mix help compile.app" to learn about applications. def application do [ - extra_applications: [:logger] + extra_applications: [:logger, :public_key] ] end