Skip to content

Commit

Permalink
[master] removing travis-ci (2600hz#6096)
Browse files Browse the repository at this point in the history
* upload coverage report in circleci and add description for circeleci steps

* we don't need travis anymore

* use the new 2600hz docker image

* invalidate cache if erlang version is changed, also revert .kz_deps_hash

* remove superfluous step

* show which command is running for code checks

* update erlang in apps circelci config files

* show what your are doing code_checks
  • Loading branch information
icehess authored and swysor committed Oct 17, 2019
1 parent ef1b1ce commit 327c910
Show file tree
Hide file tree
Showing 41 changed files with 894 additions and 829 deletions.
180 changes: 134 additions & 46 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ version: 2

workflows:
version: 2
build-analyze-run:
build_branch:
jobs:
- setup
- build:
- build_deps:
requires:
- setup
- build:
requires:
- build_deps
- eunit_tests:
requires:
- build_deps
- checks:
requires:
- build
Expand All @@ -23,7 +29,7 @@ workflows:

defaults: &defaults
docker:
- image: offical2600hz/circleci:21.3.8
- image: offical2600hz/circleci:21.3.8.8
working_directory: ~/2600hz/kazoo
shell: /bin/bash --login
environment:
Expand All @@ -34,96 +40,178 @@ jobs:
<<: *defaults
steps:
- checkout
- run: make changed
- run:
name: Listing Changes
command: make changed
- persist_to_workspace:
root: .
paths:
- .
build:
build_deps:
<<: *defaults
steps:
- attach_workspace:
at: .
- restore_cache:
keys:
- deps-erl21-v1-{{ checksum "make/deps.mk" }}
- run: |
deps_hash=$(md5sum make/deps.mk | cut -d" " -f1)
if [ x"$(cat .git/.kz_deps_hash)" = x"$deps_hash" ]; then
touch "make/.deps.mk.$deps_hash"
fi
- run: JOBS="2" make
- run: echo -n $(md5sum make/deps.mk | cut -d" " -f1) > .git/.kz_deps_hash
- deps-v1-{{ checksum "make/deps.mk" }}-{{ checksum "/usr/local/lib/erlang/releases/RELEASES" }}
- run:
name: Calculating dependency hash for CircleCI cache
command: |
deps_hash=$(md5sum make/deps.mk | cut -d" " -f1)
if [ x"$(cat .git/.kz_deps_hash)" = x"$deps_hash" ]; then
touch "make/.deps.mk.$deps_hash"
fi
echo -n $(md5sum make/deps.mk | cut -d" " -f1) > ".git/.kz_deps_hash"
- run:
name: Show dependency hash
command: |
md5sum make/deps.mk || true
ls -al make || true
- run:
name: Making dependencies
command : make deps
- save_cache:
key: deps-erl21-v1-{{ checksum "make/deps.mk" }}
key: deps-v1-{{ checksum "make/deps.mk" }}-{{ checksum "/usr/local/lib/erlang/releases/RELEASES" }}
paths:
- deps/
- .git/.kz_deps_hash
- persist_to_workspace:
root: .
paths:
- .
build:
<<: *defaults
steps:
- attach_workspace:
at: .
- restore_cache:
keys:
- deps-v1-{{ checksum "make/deps.mk" }}-{{ checksum "/usr/local/lib/erlang/releases/RELEASES" }}
- run:
name: Compiling the project
command: JOBS="2" make
- persist_to_workspace:
root: .
paths:
- .
eunit_tests:
<<: *defaults
steps:
- attach_workspace:
at: .
- restore_cache:
keys:
- deps-v1-{{ checksum "make/deps.mk" }}-{{ checksum "/usr/local/lib/erlang/releases/RELEASES" }}
- run:
name: Compiling for unit test enviornment
command: ERLC_OPTS='-DPROPER' make compile-test
- run:
name: Running Eunit/Proper tests
command: make eunit
- run:
name: Uploading Coverage Report
command: make coverage-report
checks:
<<: *defaults
steps:
- attach_workspace:
at: .
- run: make fmt
- run: make code_checks
- run: make app_applications
- run: make xref
- run: make sup_completion
- run: make elvis
- run: ${PWD}/scripts/check-unstaged.bash

- run:
name: Running code formatter
command: make fmt
- run:
name: Running code checks
command: make code_checks
- run:
name: Making app applications
command: make app_applications
- run:
name: Generating sup bash completion file
command: make sup_completion
- run:
name: Running xref check
command: make xref
- run:
name: Running Elvis code style check
command: make elvis
- run:
name: Checking for unstaged files
command: scripts/check-unstaged.bash
docs:
<<: *defaults
steps:
- attach_workspace:
at: .
- run: make apis
- run: make validate-js
- run: make validate-schemas
- run: make docs
- run: ./scripts/state-of-docs.sh || true
- run: ./scripts/state-of-edoc.escript
- run: ${PWD}/scripts/check-unstaged.bash

- run:
name: Generating APIs
command: make apis
- run:
name: Validating CouchDB view files
command: make validate-js
- run:
name: Validating schemas
command: make validate-schemas
- run:
name: Generating docs
command: make docs || true
- run:
name: Checking doc states
command: scripts/state-of-docs.sh || true
- run:
name: Checking EDoc states
command: scripts/state-of-edoc.escript
- run:
name: Checking for unstaged files
command: scripts/check-unstaged.bash
analyze:
<<: *defaults
steps:
- attach_workspace:
at: .
- restore_cache:
keys:
- plt-erl21-v1-{{ checksum "make/deps.mk" }}
- run: make build-plt dialyze-changed
- plt-v1-{{ checksum "~/2600hz/kazoo/make/deps.mk" }}-{{ checksum "/usr/local/lib/erlang/releases/RELEASES" }}
- run:
name: Dailyzing changed Erlang files
command: make build-plt dialyze-changed
- save_cache:
key: plt-erl21-v1-{{ checksum "make/deps.mk" }}
key: plt-v1-{{ checksum "make/deps.mk" }}-{{ checksum "/usr/local/lib/erlang/releases/RELEASES" }}
paths:
- .kazoo.plt

release:
<<: *defaults
docker:
- image: offical2600hz/circleci:21.3.8
- image: couchdb:2.1.1
- image: offical2600hz/circleci:21.3.8.8
- image: couchdb:2.3.1
- image: 2600hz/rabbitmq
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
TZ: "/usr/share/zoneinfo/UTC"
steps:
- attach_workspace:
at: .
- run: mkdir -p $CIRCLE_ARTIFACTS
- run: make build-ci-release
- run: KAZOO_CONFIG=${PWD}/rel/ci.config.ini REL="kazoo_apps" ACT="console" NODE_NAME_TYPE="-sname" make release
- run: cp ${PWD}/rel/ci.relx.config $CIRCLE_ARTIFACTS/
- run: find ${PWD}/_rel/kazoo/releases -name kazoo.rel -exec cp {} $CIRCLE_ARTIFACTS/ \;
- run:
name: Creating artifacts directory
command: mkdir -p $CIRCLE_ARTIFACTS
- run:
name: Making CI release
command: make build-ci-release
- run:
name: Running Kazoo release
command: KAZOO_CONFIG=${PWD}/rel/ci.config.ini REL="kazoo_apps" ACT="console" NODE_NAME_TYPE="-sname" make release
- run:
name: Copying Relx config artifacts
command: cp ${PWD}/rel/ci.relx.config $CIRCLE_ARTIFACTS/
- run:
name: Copying release Artifacts
command: find ${PWD}/_rel/kazoo/releases -name kazoo.rel -exec cp {} $CIRCLE_ARTIFACTS/ \;
- store_artifacts:
path: /tmp/circleci-artifacts
- run: |
if [[ $(grep -c -v -F 'exit with reason shutdown' ${CIRCLE_ARTIFACTS}/log/error.log) -gt 0 ]]; then
cat ${CIRCLE_ARTIFACTS}/log/error.log
exit 1
fi
- run:
name: Checking for errors
command: |
if [[ $(grep -c -v -F 'exit with reason shutdown' ${CIRCLE_ARTIFACTS}/log/error.log) -gt 0 ]]; then
cat ${CIRCLE_ARTIFACTS}/log/error.log
exit 1
fi
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,23 @@ app_applications:
ERL_LIBS=deps:core:applications $(ROOT)/scripts/apps_of_app.escript -a $(shell find applications -name *.app.src)

code_checks:
@printf ":: Check for copyright year\n\n"
@$(ROOT)/scripts/bump-copyright-year.sh $(CHANGED_ERL)
@$(ROOT)/scripts/code_checks.bash $(CHANGED)
@printf "\n:: Check code\n\n"
@$(ROOT)/scripts/code_checks.bash $(CHANGED_ERL)
@printf "\n:: Check for raw JSON usage\n\n"
@ERL_LIBS=deps:core:applications $(ROOT)/scripts/no_raw_json.escript $(CHANGED_ERL)
@printf "\n:: Check for spelling\n\n"
@$(ROOT)/scripts/check-spelling.bash
@printf "\n:: Check for Kazoo diaspora\n\n"
@$(ROOT)/scripts/kz_diaspora.bash
@printf "\n:: Check for Edoc\n\n"
@$(ROOT)/scripts/edocify.escript
@printf "\n:: Check for Kazoo document accessors\n\n"
@$(ROOT)/scripts/kzd_module_check.bash
@printf "\n:: Check for proper log message usage\n\n"
@$(ROOT)/scripts/check-loglines.bash
@printf "\n:: Check for Erlang 21 new stacktrace syntax\n\n"
@$(ROOT)/scripts/check-stacktrace.py $(CHANGED_ERL)

.PHONY: raw_json_check
Expand Down
Loading

0 comments on commit 327c910

Please sign in to comment.