Skip to content

Commit

Permalink
Switch to CodeCov and speed up build (#19)
Browse files Browse the repository at this point in the history
* Adds inch as a script

* Make travis fail fast at format check

* Inch Reports are made only for master and develop

* This may not work! Because these branches recieve commits only via
PRs.

* Replace Coveralls with CodeCov

* Improve exdocs layout
  • Loading branch information
oyeb authored and pkrawat1 committed Mar 5, 2018
1 parent d20f5a9 commit 40ebacf
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 18 deletions.
22 changes: 22 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
coverage:
precision: 2
round: down
range: "60...90"

status:
project:
default: on
patch:
default: on
changes:
default: on

codecov:
branch: develop

comment:
layout: "header, reach, diff, flags, files, footer"
behavior: default
require_changes: no
require_base: no
require_head: yes
20 changes: 20 additions & 0 deletions .scripts/inch_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e
bold=$(tput bold)
purple='\e[106m'
normal=$(tput sgr0)
allowed_branches="^(master)|(develop)$"

echo -e "${bold}${purple}"
if [ $TRAVIS_PULL_REQUEST = false ]; then
if [[ $TRAVIS_BRANCH =~ $allowed_branches ]]; then
env MIX_ENV=docs mix deps.get
env MIX_ENV=docs mix inch.report
else
echo "Skipping Inch CI report because this branch does not match on /$allowed_branches/"
fi
else
echo "Skipping Inch CI report because this is a PR build"
fi
echo -e "${normal}"
25 changes: 19 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
language: elixir
elixir:
- 1.5.3
- 1.6.2

otp_release:
- 20.2
before_install:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
script:
- mix coveralls.travis --umbrella
- set -e
- MIX_ENV=test mix format --check-formatted
- set +e
- mix coveralls.json --umbrella
after_script:
- mix deps.get --only docs
- MIX_ENV=docs mix inch.report
- bash <(curl -s https://codecov.io/bash)
- bash .scripts/inch_report.sh

matrix:
include:
- elixir: "1.5.3"
script:
- mix coveralls.json --umbrella
- elixir: "1.6.2"

notifications:
email:
recipients:
- ananya95+travis@gmail.com
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Snitch

[![Build Status](https://travis-ci.org/aviabird/snitch.svg?branch=develop)](https://travis-ci.org/aviabird/snitch)
[![Coverage Status](https://coveralls.io/repos/github/aviabird/snitch/badge.svg?branch=travis%2Finit)](https://coveralls.io/github/aviabird/snitch?branch=travis%2Finit)
[![codecov](https://codecov.io/gh/aviabird/snitch/branch/develop/graph/badge.svg)](https://codecov.io/gh/aviabird/snitch)
[![Inline docs](http://inch-ci.org/github/aviabird/snitch.svg)](http://inch-ci.org/github/aviabird/snitch)

An umbrella application
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/snitch/data/model/model.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Core.Snitch.Data.Model do
alias Helpers.QueryHelper, as: QH

alias Core.Snitch.Data.{Schema, Model}

use Core.Snitch.Data.Model.{
Stock
}
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/snitch/domain/domain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Core.Snitch.Domain do
Interface for handling Business related logics.
Uses Models for DB related queries.
"""

defmacro __using__(_) do
quote do
alias Core.Snitch.{Data.Model, Data.Schema, Domain, Repo}
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/snitch/domain/stock/inventory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ defmodule Core.Snitch.Domain.Stock.Inventory do
@moduledoc """
Interface for handling inventory related business logic
"""

use Core.Snitch.Domain
end
33 changes: 26 additions & 7 deletions apps/core/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ defmodule Core.Mixfile do
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.4",
elixir: "~> 1.5",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCoveralls]
test_coverage: [tool: ExCoveralls],
docs: docs()
]
end

Expand Down Expand Up @@ -47,16 +48,34 @@ defmodule Core.Mixfile do
{:comeonin, "~> 4.0"},
{:argon2_elixir, "~> 1.2"},

# countries etc
{:excountries, "~> 0.0.1"},
{:yamerl, github: "yakaz/yamerl", override: true},
{:worldly, github: "martide/worldly"},
{:uuid, "~> 1.1"},

# docs and tests
{:ex_doc, "~> 0.16", only: :dev, runtime: false},
{:excoveralls, "~> 0.8", only: :test},
{:ex_machina, "~> 2.1", only: :test},
{:dialyxir, "~> 0.5", only: [:dev], runtime: false},
{:inch_ex, "~> 0.5.6", only: [:docs, :dev]},
{:excountries, "~> 0.0.1"},
{:yamerl, github: "yakaz/yamerl", override: true},
{:worldly, github: "martide/worldly"},
{:uuid, "~> 1.1"}
{:inch_ex, "~> 0.5.6", only: [:docs, :dev]}
]
end

defp docs do
[
main: Core.Snitch.Data.Schema.Order,
source_url: "https://github.com/aviabird/snitch",
groups_for_modules: groups_for_modules()
]
end

defp groups_for_modules do
[
Schema: ~r/^Core.Snitch.Data.Schema.?/,
Models: ~r/^Core.Snitch.Data.Model.?/,
Domain: ~r/^Core.Snitch.Domain.?/
]
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Snitch.Mixfile do
start_permanent: Mix.env() == :prod,
deps: deps(),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [coveralls: :test, "coveralls.travis": :test, "coveralls.html": :test]
preferred_cli_env: [coveralls: :test, "coveralls.json": :test, "coveralls.html": :test]
]
end

Expand Down

0 comments on commit 40ebacf

Please sign in to comment.