-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from fewlinesco/release/v3.1.0
Bump to v3.1.0 This release contains: Fix for using custom config with response: true by bumping bamboo version to ~> 1.6 (#150) Implement our custom test adapter ([#151]) Fix CI random failure by attaching FakeGenSMTP Server process to Test supervision tree.(#153) Add Content-ID header when needed(#154) Base 64 encode the headers only when the content contains non-ASCII characters.(#155) Handle :permanent_failure exception and re-raising it as a SMTPError.(#156) After bumping the dependencies, the project requires(#149): credo ~> 1.4.1 bamboo ~> 1.6 excoveralls ~> 0.13.3 gen_smtp ~> 1.0.1
- Loading branch information
Showing
11 changed files
with
313 additions
and
84 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,59 @@ | ||
name: Bamboo SMTP | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
name: Test on Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
elixir: [1.7.4, 1.8.2, 1.9.1, 1.10.3] | ||
otp: [19.3, 20.3, 21.3, 22.0] | ||
exclude: | ||
- elixir: 1.8.2 | ||
otp: 19.3 | ||
- elixir: 1.9.1 | ||
otp: 19.3 | ||
- elixir: 1.10.3 | ||
otp: 19.3 | ||
- elixir: 1.10.3 | ||
otp: 20.3 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-elixir-${{ matrix.elixir }}-otp-${{ matrix.otp }} | ||
|
||
- uses: actions/setup-elixir@v1 | ||
with: | ||
otp-version: ${{ matrix.otp }} | ||
elixir-version: ${{ matrix.elixir }} | ||
|
||
- run: mix deps.get | ||
- run: mix compile --warnings-as-errors | ||
- run: mix credo --strict | ||
- run: mix test | ||
|
||
doc: | ||
name: Generate inch report | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
|
||
- uses: actions/setup-elixir@v1 | ||
with: | ||
otp-version: 22.0 | ||
elixir-version: 1.10.3 | ||
|
||
- run: mix deps.get --only docs | ||
- run: MIX_ENV=docs mix inch.report |
This file was deleted.
Oops, something went wrong.
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
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,56 @@ | ||
defmodule BambooSMTP.TestAdapter do | ||
@moduledoc """ | ||
Based on `Bamboo.TestAdapter`, this module can be used for testing email delivery. | ||
The `deliver/2` function will provide a response that follow the format of a SMTP server raw response. | ||
No emails are sent, instead it sends back `{%Bamboo.Email{...}, {:ok,"<raw_smtp_response>"}}` | ||
for success and raise an exception on error. | ||
## Example config | ||
# Typically done in config/test.exs | ||
config :my_app, MyApp.Mailer, | ||
adapter: BambooSMTP.TestAdapter | ||
# Define a Mailer. Typically in lib/my_app/mailer.ex | ||
defmodule MyApp.Mailer do | ||
use Bamboo.Mailer, otp_app: :my_app | ||
end | ||
""" | ||
|
||
@behaviour Bamboo.Adapter | ||
|
||
@doc false | ||
def deliver(_email, _config) do | ||
send(test_process(), {:ok, "Ok #{Enum.random(100_000_000..999_999_999)}"}) | ||
end | ||
|
||
defp test_process do | ||
Application.get_env(:bamboo, :shared_test_process) || self() | ||
end | ||
|
||
def handle_config(config) do | ||
case config[:deliver_later_strategy] do | ||
nil -> | ||
Map.put(config, :deliver_later_strategy, Bamboo.ImmediateDeliveryStrategy) | ||
|
||
Bamboo.ImmediateDeliveryStrategy -> | ||
config | ||
|
||
_ -> | ||
raise ArgumentError, """ | ||
BambooSMTP.TestAdapter requires that the deliver_later_strategy is | ||
Bamboo.ImmediateDeliveryStrategy | ||
Instead it got: #{inspect(config[:deliver_later_strategy])} | ||
Please remove the deliver_later_strategy from your config options, or | ||
set it to Bamboo.ImmediateDeliveryStrategy. | ||
""" | ||
end | ||
end | ||
|
||
@doc false | ||
def supports_attachments?, do: true | ||
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.