-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f02f244
commit 442dddb
Showing
6 changed files
with
325 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
MIX_ENV: test | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- pair: | ||
elixir: "1.11" | ||
otp: "21.3" | ||
- pair: | ||
elixir: "1.16" | ||
otp: "26.1" | ||
lint: lint | ||
steps: | ||
- name: Check out this repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Erlang and Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ matrix.pair.otp }} | ||
elixir-version: ${{ matrix.pair.elixir }} | ||
|
||
- name: Cache Mix dependencies | ||
uses: actions/cache@v3 | ||
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: Fetch dependencies | ||
run: mix deps.get --check-lock | ||
|
||
- name: Check formatting | ||
run: mix format --check-formatted | ||
if: ${{ matrix.lint }} | ||
|
||
- name: Check unused dependencies | ||
run: mix deps.unlock --check-unused | ||
if: ${{ matrix.lint }} | ||
|
||
- name: Compile dependencies | ||
run: mix deps.compile | ||
|
||
- name: Compile and check for warnings | ||
run: mix compile --warnings-as-errors | ||
if: ${{ matrix.lint }} | ||
|
||
- name: Run tests | ||
run: mix test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
defmodule NimbleOwnership.Error do | ||
@moduledoc """ | ||
Exception struct returned by `NimbleOwnership` functions. | ||
""" | ||
|
||
@type t() :: %__MODULE__{ | ||
reason: {:already_allowed, pid()} | ||
} | ||
|
||
defexception [:reason] | ||
|
||
@impl true | ||
def message(%__MODULE__{reason: reason}) do | ||
format_reason(reason) | ||
end | ||
|
||
defp format_reason({:already_allowed, other_owner_pid}) do | ||
"this PID is already allowed to access key via other owner PID #{inspect(other_owner_pid)}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.