From 38d26604b3cd245c63384caef165674ed9f419cb Mon Sep 17 00:00:00 2001 From: Sean Callan Date: Thu, 9 Jan 2020 07:29:52 -0700 Subject: [PATCH] GitHub Action CI (#78) * Manage CI via GitHub Actions * Format codebase * Remove Travis CI * Update version and phoenix_html versions * Fix failing tests due to updated dependencies --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++ .travis.yml | 10 ----- lib/phoenix_slime.ex | 11 +++--- mix.exs | 4 +- test/mix/tasks/phx.gen.html.slime_test.exs | 4 +- test/phoenix_slime_test.exs | 5 +-- 6 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8b9f308 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: Continuous Integration + +on: + pull_request: + types: [opened, reopened, synchronize] + push: + branches: + - 'master' +jobs: + Test: + runs-on: ubuntu-latest + + container: + image: elixir:1.9-alpine + + steps: + - name: Checkout Code + uses: actions/checkout@v1 + + - name: Install Dependencies + run: | + mix local.rebar --force + mix local.hex --force + mix deps.get + + - name: Run Tests + run: mix test + + Linting: + runs-on: ubuntu-latest + + container: + image: elixir:1.9-alpine + + steps: + - name: Checkout Code + uses: actions/checkout@v1 + + - name: Install Dependencies + run: | + mix local.rebar --force + mix local.hex --force + mix deps.get + + - name: Run Formatter + run: mix format --check-formatted diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7bb125a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: elixir -matrix: - include: - - otp_release: 19.2 - elixir: 1.4.2 -sudo: false -notifications: - email: false -script: - - mix test diff --git a/lib/phoenix_slime.ex b/lib/phoenix_slime.ex index db98131..a23f47b 100644 --- a/lib/phoenix_slime.ex +++ b/lib/phoenix_slime.ex @@ -9,7 +9,7 @@ defmodule PhoenixSlime do iex> ~l"\"" ...> p = "hello " <> @w ...> "\"" - {:safe, [[["" | "

"] | "hello world"] | "

"]} + {:safe, ["

", "hello world", "

"]} """ defmacro sigil_l(expr, opts) do handle_sigil(expr, opts, __CALLER__.line) @@ -22,7 +22,7 @@ defmodule PhoenixSlime do iex> ~L"\"" ...> p hello \#{"world"} ...> "\"" - {:safe, [[["" | "

hello "] | "world" ] | "

"]} + {:safe, ["

hello ", "world", "

"]} """ defmacro sigil_L(expr, opts) do handle_sigil(expr, opts, __CALLER__.line) @@ -35,8 +35,9 @@ defmodule PhoenixSlime do end defp handle_sigil(_, _, _) do - raise ArgumentError, ~S(Templating is not allowed with #{} in ~l sigil.) <> - ~S( Remove the #{}, use = to insert values, or ) <> - ~S(use ~L to template with #{}.) + raise ArgumentError, + ~S(Templating is not allowed with #{} in ~l sigil.) <> + ~S( Remove the #{}, use = to insert values, or ) <> + ~S(use ~L to template with #{}.) end end diff --git a/mix.exs b/mix.exs index 726f026..ac3d24f 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule PhoenixSlime.Mixfile do use Mix.Project - @version "0.13.0" + @version "0.13.1" def project do [ @@ -21,7 +21,7 @@ defmodule PhoenixSlime.Mixfile do def deps do [ {:phoenix, "~> 1.4"}, - {:phoenix_html, "~> 2.10"}, + {:phoenix_html, "~> 2.13"}, {:jason, "~> 1.0", optional: true}, {:slime, "~> 1.0"}, {:ex_doc, ">= 0.0.0", only: :dev}, diff --git a/test/mix/tasks/phx.gen.html.slime_test.exs b/test/mix/tasks/phx.gen.html.slime_test.exs index b66726c..11824cc 100644 --- a/test/mix/tasks/phx.gen.html.slime_test.exs +++ b/test/mix/tasks/phx.gen.html.slime_test.exs @@ -23,8 +23,8 @@ defmodule Mix.Tasks.Phx.Gen.Html.SlimeTest do alarm:time address_id:references:addresses)) assert_file("lib/phoenix_slime/accounts/user.ex") - assert_file("lib/phoenix_slime/accounts/accounts.ex") - assert_file("test/phoenix_slime/accounts/accounts_test.exs") + assert_file("lib/phoenix_slime/accounts.ex") + assert_file("test/phoenix_slime/accounts_test.exs") assert [_] = Path.wildcard("priv/repo/migrations/*_create_users.exs") assert_file("lib/phoenix_slime_web/templates/user/edit.html.slime", fn file -> diff --git a/test/phoenix_slime_test.exs b/test/phoenix_slime_test.exs index 8013ad9..d74535b 100644 --- a/test/phoenix_slime_test.exs +++ b/test/phoenix_slime_test.exs @@ -16,12 +16,11 @@ defmodule PhoenixSlimeTest do layout: {MyApp.PageView, "application.html"} ) - assert html == - {:safe, [[["" | ""], "" | "

New Template

"] | ""]} + assert html == {:safe, ["", ["

New Template

"], ""]} end test "render a slime template without layout" do html = View.render(MyApp.PageView, "new.html", []) - assert html == {:safe, ["" | "

New Template

"]} + assert html == {:safe, ["

New Template

"]} end end