Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
pull_request:
push:
branches: [main]
workflow_call:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: CargoSense/setup-elixir-project@v1
with:
elixir-version: "1.19"
otp-version: 28
- run: mix format --check-formatted
- run: mix deps.unlock --check-unused
if: ${{ !cancelled() }}
- run: mix credo
if: ${{ !cancelled() }}
test:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
fail-fast: false
matrix:
otp: [29, 28, 27, 26, 25]
elixir: ["1.20", "1.19", "1.18"]
exclude:
- otp: 26
elixir: "1.20"
- otp: 25
elixir: "1.20"
- otp: 29
elixir: "1.19"
- otp: 25
elixir: "1.19"
- otp: 29
elixir: "1.18"
- otp: 28
elixir: "1.18"
steps:
- uses: actions/checkout@v7
- uses: CargoSense/setup-elixir-project@v1
with:
build-flags: --no-optional-deps --warnings-as-errors
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- run: mix test
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that if we want to use this workflow, we'll need to add an env with a Hex API key secret to the mix hex.publish --yes job step.

If we'd rather hand-publish this package, we can remove this workflow from the PR.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish

on:
release:
types: [published]

jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
publish:
name: Publish to Hex
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: CargoSense/setup-elixir-project@v1
- run: mix hex.publish --yes
2 changes: 1 addition & 1 deletion lib/fable/process_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ defmodule Fable.ProcessManager do
end)
end

defp handle_run_event(event, state) do
defp handle_run_event(event, %__MODULE__{} = state) do
case run_handler(state, event) do
{:ok, data} ->
state.handler
Expand Down
4 changes: 2 additions & 2 deletions test/events_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ defmodule Fable.EventsTest do
end

describe "emit/2" do
test "returns a zero arity callback with an schema as first argument" do
test "returns a callback taking a repo when given a schema" do
aggregate = %Aggregate{id: Ecto.UUID.generate()}

fun =
Events.emit(aggregate, fn _aggregate, _repo, _changes ->
%Aggregate.Created{}
end)

assert is_function(fun, 0)
assert is_function(fun, 1)
end
end

Expand Down
Loading