From c5704c4e093c1ff1d7376fcf5ab330f34436c260 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Fri, 25 Oct 2019 14:18:07 +0800 Subject: [PATCH] Add travis and coveralls --- .travis.yml | 5 +++++ config/dev.exs | 4 +++- lib/mix/tasks/send_email_reports.ex | 2 +- mix.exs | 4 +++- mix.lock | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..a6a0a582d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: elixir +elixir: '1.7.4' +otp_release: '21.1' +services: + - postgresql diff --git a/config/dev.exs b/config/dev.exs index e918e1bde..887d71398 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -45,4 +45,6 @@ config :plausible, Plausible.Repo, config :plausible, Plausible.Mailer, adapter: Bamboo.LocalAdapter -import_config "dev.secret.exs" +if File.exists?("dev.secret.exs") do + import_config "dev.secret.exs" +end diff --git a/lib/mix/tasks/send_email_reports.ex b/lib/mix/tasks/send_email_reports.ex index ecaac6ed8..e79c0be5a 100644 --- a/lib/mix/tasks/send_email_reports.ex +++ b/lib/mix/tasks/send_email_reports.ex @@ -12,7 +12,7 @@ defmodule Mix.Tasks.SendEmailReports do The email report should be sent on Monday at 9am according to the timezone of the site. This job runs every hour to be able to send it with hourly precision. """ - def execute(args \\ []) do + def execute(_args \\ []) do send_weekly_emails() send_monthly_emails() end diff --git a/mix.exs b/mix.exs index 61883cbee..f77122edf 100644 --- a/mix.exs +++ b/mix.exs @@ -9,7 +9,8 @@ defmodule Plausible.MixProject do elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), - deps: deps() + deps: deps(), + test_coverage: [tool: ExCoveralls] ] end @@ -56,6 +57,7 @@ defmodule Plausible.MixProject do {:sentry, "~> 7.0"}, {:httpoison, "~> 1.4"}, {:ex_machina, "~> 2.3", only: :test}, + {:excoveralls, "~> 0.10", only: :test}, {:joken, "~> 2.0"}, {:php_serializer, "~> 0.9.0"} ] diff --git a/mix.lock b/mix.lock index 02da57b55..a7dc2fa82 100644 --- a/mix.lock +++ b/mix.lock @@ -21,6 +21,7 @@ "elixir_uuid": {:hex, :elixir_uuid, "1.2.0", "ff26e938f95830b1db152cb6e594d711c10c02c6391236900ddd070a6b01271d", [:mix], [], "hexpm"}, "ex_crypto": {:hex, :ex_crypto, "0.10.0", "af600a89b784b36613a989da6e998c1b200ff1214c3cfbaf8deca4aa2f0a1739", [:mix], [{:poison, ">= 2.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, "ex_machina": {:hex, :ex_machina, "2.3.0", "92a5ad0a8b10ea6314b876a99c8c9e3f25f4dde71a2a835845b136b9adaf199a", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}], "hexpm"}, + "excoveralls": {:hex, :excoveralls, "0.12.0", "50e17a1b116fdb7facc2fe127a94db246169f38d7627b391376a0bc418413ce1", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, "file_system": {:hex, :file_system, "0.2.6", "fd4dc3af89b9ab1dc8ccbcc214a0e60c41f34be251d9307920748a14bf41f1d3", [:mix], [], "hexpm"}, "gettext": {:hex, :gettext, "0.16.1", "e2130b25eebcbe02bb343b119a07ae2c7e28bd4b146c4a154da2ffb2b3507af2", [:mix], [], "hexpm"}, "hackney": {:hex, :hackney, "1.15.1", "9f8f471c844b8ce395f7b6d8398139e26ddca9ebc171a8b91342ee15a19963f4", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},