Skip to content

Commit

Permalink
Faster CI! (2600hz#2173)
Browse files Browse the repository at this point in the history
* move fast checks to top in Travis

* circleci file

* fix indent

* to each circleci test their own block

* have circle run couchjs stuff

* remove Travis things now run by Circle

* only create PLT when applications or core files were edited

* make compile-test would fail to create $(GEN_OUT)

$(GEN_OUT) generation calls erlc anyway

* allow compile-test right after cloning

* make compile-test would fail to create $(ITU)

* do not duplicate erlc statements

* move fast checks to top in Circle

* better split work between Circle and Travis

* use circle's pre|ov|post for better explicitness

* elvis needs deps/ dir to build

* add kz_mime to SOURCES as the var is expended too early

* add kz_iso3166a2_itu to SOURCES as the var is expended too early

* stop circle build on first error

* expand SOURCES var as late as possible

* ci: add Circle badge to README.md
  • Loading branch information
fenollp authored and lazedo committed Jun 30, 2016
1 parent 9b0174e commit 92659dd
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 37 deletions.
25 changes: 4 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ otp_release:

sudo: false

services:
- rabbitmq
- couchdb

addons:
apt:
packages:
Expand All @@ -31,22 +27,9 @@ before_install:
- if [[ ! -d $HOME/proper/.git/ ]]; then git clone --depth=50 --branch=master https://github.com/manopapad/proper.git $HOME/proper && cd $HOME/proper && make fast; fi
- cd $TRAVIS_BUILD_DIR

script: make compile

after_success:
- if [[ 0 -ne `git status --porcelain -- applications/ core/ | wc -l` ]]; then echo Unstaged changes! && git diff && exit 1; fi
- make xref
- ./scripts/code_checks.bash
- git fetch origin master:master
- files="$(git diff --name-only master... -- application/ core/)" || true && echo $files
- make build-plt
- ./scripts/check-dialyzer.escript .kazoo.plt $files
- ./scripts/validate-js.sh $(find applications/ core/ -name '*.json')
- make sup_completion
- make build-ci-release
- # ERL_LIBS="$HOME/proper" ERLC_OPTS='-DPROPER' make compile-test
- # ERL_LIBS="$HOME/proper" make eunit
script:
- make compile-test
- make eunit
- make elvis
- ./scripts/check-release-startup.sh
- make eunit
- # ERL_LIBS="$HOME/proper" ERLC_OPTS='-DPROPER' make compile-test
- # ERL_LIBS="$HOME/proper" make eunit
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ clean-kazoo: ACTION = clean
clean-kazoo: $(KAZOODIRS)

compile-test: ACTION = compile-test
compile-test: $(KAZOODIRS)
compile-test: deps $(KAZOODIRS)

eunit: ACTION = eunit
eunit: $(KAZOODIRS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Kazoo [![Build Status](https://travis-ci.org/2600hz/kazoo.svg?branch=master)](https://travis-ci.org/2600hz/kazoo) [![Issue Stats](http://issuestats.com/github/2600hz/kazoo/badge/pr)](http://issuestats.com/github/2600hz/kazoo) [![2600Hz IRC](https://img.shields.io/badge/irc-%232600hz-orange.svg)](https://webchat.freenode.net/?channels=2600hz) [![Project Stats](https://www.openhub.net/p/KazooPlatform/widgets/project_thin_badge.gif)](https://www.openhub.net/p/KazooPlatform)
## Kazoo [![TravisCI build status](https://travis-ci.org/2600hz/kazoo.svg?branch=master)](https://travis-ci.org/2600hz/kazoo) [![CircleCI build status](https://circleci.com/gh/2600hz/kazoo/tree/master.svg?style=shield)](https://circleci.com/gh/2600hz/kazoo) [![Issue Stats](http://issuestats.com/github/2600hz/kazoo/badge/pr)](http://issuestats.com/github/2600hz/kazoo) [![2600Hz IRC](https://img.shields.io/badge/irc-%232600hz-orange.svg)](https://webchat.freenode.net/?channels=2600hz) [![Project Stats](https://www.openhub.net/p/KazooPlatform/widgets/project_thin_badge.gif)](https://www.openhub.net/p/KazooPlatform)

**[Periodically check our announcements for important developer updates!](https://github.com/2600hz/kazoo/tree/master/doc/announcements.md)**

Expand Down
47 changes: 47 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
machine:
environment:
OTP_VERSION: 18.2
PATH: ${HOME}/.kerl/$OTP_VERSION/bin:${PATH}
services:
- rabbitmq-server
# - couchdb-server

dependencies:
cache_directories:
- ~/.kerl
pre:
- |
if [[ ! -d ~/.kerl/$OTP_VERSION ]]; then
if [[ ! -d ~/.kerl ]]; then
mkdir ~/.kerl
curl -fsSLo ~/.kerl/kerl https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod +x ~/.kerl/kerl
~/.kerl/kerl update releases
fi
~/.kerl/kerl build $OTP_VERSION $OTP_VERSION
~/.kerl/kerl install $OTP_VERSION ~/.kerl/$OTP_VERSION
fi
test:
pre:
- ./scripts/validate-js.sh $(find applications/ core/ -name '*.json')
- ./scripts/code_checks.bash
- . ~/.kerl/$OTP_VERSION/activate && make
- |
if [[ 0 -ne `git status --porcelain | wc -l` ]]; then
echo Unstaged changes!
git diff
exit 1
fi
- . ~/.kerl/$OTP_VERSION/activate && make xref
- . ~/.kerl/$OTP_VERSION/activate && make sup_completion
- |
. ~/.kerl/$OTP_VERSION/activate
files="$(git diff --name-only master... applications/ core/)" || true
echo .$files.
if [[ ! -z "$files" ]]; then
make build-plt
./scripts/check-dialyzer.escript .kazoo.plt $files
fi
- . ~/.kerl/$OTP_VERSION/activate && make build-ci-release
- . ~/.kerl/$OTP_VERSION/activate && ./scripts/check-release-startup.sh
13 changes: 7 additions & 6 deletions core/kazoo/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
ROOT = ../..
PROJECT = kazoo

SOURCES = src/kazoo_transform.erl src/*.erl src/api/*.erl

CLEAN_MOAR = clean-generated

# Mimetypes module generator.

GEN_URL = http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
GEN_FILE = mime.types
GEN_SRC = src/kz_mime.erl.src
GEN_OUT = src/kz_mime.erl

all: compile | $(GEN_OUT)
SOURCES = src/kazoo_transform.erl src/*.erl src/api/*.erl $(GEN_OUT)

COMPILE_MOAR = $(GEN_OUT)
CLEAN_MOAR = clean-generated

all: compile

include $(ROOT)/make/kz.mk

Expand Down Expand Up @@ -56,3 +56,4 @@ $(GEN_OUT): $(GEN_FILE) $(GEN_SRC)
tail -n +`grep -n '%% GENERATED' $(GEN_SRC) | cut -d: -f1` $(GEN_SRC) >> $(GEN_OUT)
@mkdir -p ebin/
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(PA) -o ebin/ $(GEN_OUT)

12 changes: 6 additions & 6 deletions core/kazoo_number_manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ROOT = ../..
PROJECT = kazoo_number_manager

CLEAN_MOAR = clean-generated

# ISO3166-alpha2 to dialcode (ITU) module generator.

ITU = src/knm_iso3166a2_itu.erl
ITU_SRC = src/knm_iso3166a2_itu.erl.src
ITU_FILE = dialcodes.json
Expand All @@ -25,7 +22,12 @@ ITU_URL = https://raw.githubusercontent.com/mledoze/countries/master/countries.j
# https://countrycode.org/
# https://en.wikipedia.org/wiki/List_of_country_calling_codes

all: compile | $(ITU)
SOURCES = src/*.erl src/*/*.erl $(ITU)

COMPILE_MOAR = $(ITU)
CLEAN_MOAR = clean-generated

all: compile

include $(ROOT)/make/kz.mk

Expand All @@ -40,5 +42,3 @@ $(ITU): $(ITU_FILE) $(ITU_SRC)
@cat $(ITU_SRC) >$(ITU)
@python -c 'from __future__ import print_function; import json; [print("to_itu(<<\"", l["cca2"], "\">>) -> <<\"+", l["callingCode"][0], "\">>;", sep="") for l in sorted(json.load(open("dialcodes.json")), key=lambda l: l["cca2"]) if len(l["callingCode"]) > 0]' >>$(ITU)
@echo 'to_itu(_) -> <<>>.' >>$(ITU)
@mkdir -p ebin/
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(PA) -o ebin/ $(ITU)
4 changes: 2 additions & 2 deletions make/kz.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TEST_SOURCES = $(SOURCES) $(if $(wildcard test/*.erl), test/*.erl)
## COMPILE_MOAR can contain Makefile-specific targets (see CLEAN_MOAR, compile-test)
compile: $(COMPILE_MOAR) ebin/$(PROJECT).app json

ebin/$(PROJECT).app: $(wildcard $(SOURCES))
ebin/$(PROJECT).app: $(SOURCES)
@mkdir -p ebin/
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(PA) -o ebin/ $?
@sed "s/{modules, \[\]}/{modules, \[`echo ebin/*.beam | sed 's%\.beam ebin/%, %g;s%ebin/%%;s/\.beam//'`\]}/" src/$(PROJECT).app.src > $@
Expand All @@ -69,7 +69,7 @@ json:
compile-test: clean-test $(COMPILE_MOAR) test/$(PROJECT).app

test/$(PROJECT).app: ERLC_OPTS += -DTEST
test/$(PROJECT).app: $(wildcard $(TEST_SOURCES))
test/$(PROJECT).app: $(TEST_SOURCES)
@mkdir -p test/
@mkdir -p ebin/
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(TEST_PA) -o ebin/ $(TEST_SOURCES)
Expand Down

0 comments on commit 92659dd

Please sign in to comment.