Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHA #85

Merged
merged 1 commit into from
Nov 20, 2023
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
45 changes: 23 additions & 22 deletions .github/workflows/build.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
name: CI

on:
push:
push:
branches: [ main ]
pull_request:
release:
types:
- published
workflow_call:

jobs:
lint:
runs-on: ubuntu-latest
name: Linter
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: 26.0
elixir-version: 1.15
- run: mix deps.get
- run: mix compile --warnings-as-errors
- run: mix credo --strict

test:
strategy:
matrix:
Expand All @@ -24,28 +38,15 @@ jobs:

runs-on: ${{ matrix.version.os }}
name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}} / ${{matrix.html_parser}}
env:
MIX_ENV: test
HTML_PARSER: ${{matrix.html_parser}}
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.version.otp}}
elixir-version: ${{matrix.version.elixir}}
- run: mix deps.get
- run: MIX_ENV=test mix compile
- run: HTML_PARSER=${{matrix.html_parser}} mix test
- run: MIX_ENV=test mix credo --strict
deploy:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
name: Deploy published release
env:
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: 25.0
elixir-version: 1.14
- run: mix deps.get
- run: mix hex.publish --yes
- run: mix compile --warnings-as-errors
- run: mix test
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish

on:
release:
types:
- published

jobs:
ci:
uses: ./.github/workflows/ci.yml

publish:
needs: ci
runs-on: ubuntu-latest
name: Publish release
env:
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: 26.0
elixir-version: 1.15
- run: mix deps.get
- run: mix hex.publish --yes
6 changes: 4 additions & 2 deletions lib/premailex/html_inline_styles.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ defmodule Premailex.HTMLInlineStyles do
CSSParser.parse(body)
end
defp parse_body({:ok, %{status: status}}, _http_adapter, url) do
Logger.warn("Ignoring #{url} styles because received unexpected HTTP status: #{status}")
Logger.warning("Ignoring #{url} styles because received unexpected HTTP status: #{status}")

nil
end
defp parse_body({:error, error}, http_adapter, url) do
Logger.warn("Ignoring #{url} styles because of unexpected error from #{inspect http_adapter}:\n\n#{inspect error}")
Logger.warning(
"Ignoring #{url} styles because of unexpected error from #{inspect(http_adapter)}:\n\n#{inspect(error)}"
)

nil
end
Expand Down
2 changes: 1 addition & 1 deletion lib/premailex/html_parser/meeseeks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Premailex.HTMLParser.Meeseeks do
|> Enum.map(&Meeseeks.tree/1)
rescue
e in Meeseeks.Error ->
Logger.warn("Meeseeks error: " <> inspect(e))
Logger.warning("Meeseeks error: " <> inspect(e))
[]
end

Expand Down
Loading