Skip to content

Commit

Permalink
Do not fail when coveralls fails to upload
Browse files Browse the repository at this point in the history
* Basically all the builds have been red :'(
  • Loading branch information
PragTob committed Aug 31, 2017
1 parent 25a4c1c commit 93505de
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ script:
- mix credo --strict
- # skip dialyzer for elixir 1.4 and erlang 18 as it produces weird errors, see #69
- if ! ([[ "$TRAVIS_ELIXIR_VERSION" == "1.4"* ]] && [[ "$TRAVIS_OTP_RELEASE" == "18"* ]]); then mix dialyzer --halt-exit-status; fi
- mix coveralls.travis
- mix safe_coveralls.travis
after_script:
- mix deps.get --only docs
- MIX_ENV=docs mix inch.report
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule Benchee.Mixfile do
preferred_cli_env: [
"coveralls": :test, "coveralls.detail": :test,
"coveralls.post": :test, "coveralls.html": :test,
"coveralls.travis": :test],
"coveralls.travis": :test, "safe_coveralls.travis": :test],
dialyzer: [
flags:
[:unmatched_returns, :error_handling, :race_conditions, :underspecs]
Expand All @@ -33,7 +33,7 @@ defmodule Benchee.Mixfile do
]
end

defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(:test), do: ["lib", "test/support", "mix"]
defp elixirc_paths(_), do: ["lib"]

def application do
Expand Down
18 changes: 18 additions & 0 deletions mix/tasks.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule Mix.Tasks.SafeCoveralls.Travis do
@moduledoc """
Provides an entry point for travis's script that's safe from upload
errors.
"""
use Mix.Task

@preferred_cli_env :test
@shortdoc "A safe variant that doesn't crash on failed upload."

def run(args) do
try do
Mix.Tasks.Coveralls.do_run(args, [type: "travis"])
rescue
ExCoveralls.ReportUploadError -> IO.puts "Upload to coveralls failed."
end
end
end

0 comments on commit 93505de

Please sign in to comment.