diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml similarity index 63% rename from .github/workflows/build.yml rename to .github/workflows/ci.yml index cf5850d..09f5b86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -24,6 +38,9 @@ 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 @@ -31,21 +48,5 @@ jobs: 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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6cf2992 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 diff --git a/lib/premailex/html_inline_styles.ex b/lib/premailex/html_inline_styles.ex index 486f687..3d99c88 100644 --- a/lib/premailex/html_inline_styles.ex +++ b/lib/premailex/html_inline_styles.ex @@ -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 diff --git a/lib/premailex/html_parser/meeseeks.ex b/lib/premailex/html_parser/meeseeks.ex index 55561aa..623a058 100644 --- a/lib/premailex/html_parser/meeseeks.ex +++ b/lib/premailex/html_parser/meeseeks.ex @@ -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