Skip to content

Commit

Permalink
GitHub Action CI (#78)
Browse files Browse the repository at this point in the history
* Manage CI via GitHub Actions

* Format codebase

* Remove Travis CI

* Update version and phoenix_html versions

* Fix failing tests due to updated dependencies
  • Loading branch information
doomspork committed Jan 9, 2020
1 parent 13cbb50 commit 38d2660
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 22 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

11 changes: 6 additions & 5 deletions lib/phoenix_slime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 9,7 @@ defmodule PhoenixSlime do
iex> ~l"\""
...> p = "hello " <> @w
...> "\""
{:safe, [[["" | "<p>"] | "hello world"] | "</p>"]}
{:safe, ["<p>", "hello world", "</p>"]}
"""
defmacro sigil_l(expr, opts) do
handle_sigil(expr, opts, __CALLER__.line)
Expand All @@ -22,7 22,7 @@ defmodule PhoenixSlime do
iex> ~L"\""
...> p hello \#{"world"}
...> "\""
{:safe, [[["" | "<p>hello "] | "world" ] | "</p>"]}
{:safe, ["<p>hello ", "world", "</p>"]}
"""
defmacro sigil_L(expr, opts) do
handle_sigil(expr, opts, __CALLER__.line)
Expand All @@ -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
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
defmodule PhoenixSlime.Mixfile do
use Mix.Project

@version "0.13.0"
@version "0.13.1"

def project do
[
Expand All @@ -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},
Expand Down
4 changes: 2 additions & 2 deletions test/mix/tasks/phx.gen.html.slime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
5 changes: 2 additions & 3 deletions test/phoenix_slime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 16,11 @@ defmodule PhoenixSlimeTest do
layout: {MyApp.PageView, "application.html"}
)

assert html ==
{:safe, [[["" | "<html><body>"], "" | "<h2>New Template</h2>"] | "</body></html>"]}
assert html == {:safe, ["<html><body>", ["<h2>New Template</h2>"], "</body></html>"]}
end

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

0 comments on commit 38d2660

Please sign in to comment.