-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable CircleCI and all new workflows
- Loading branch information
Showing
41 changed files
with
1,112 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,285 @@ | ||
version: 2.1 | ||
|
||
filters: &all_tags | ||
tags: | ||
only: /.*/ | ||
|
||
executors: | ||
elixir-builder: | ||
parameters: | ||
erlang_version: | ||
type: string | ||
default: "22.0" | ||
elixir_version: | ||
type: string | ||
default: "1.9" | ||
env: | ||
type: string | ||
default: test | ||
docker: | ||
- image: rslota/beam-builder:erlang-<< parameters.erlang_version >>_elixir-<< parameters.elixir_version >> | ||
- image: rslota/fcm-http2-mock-server | ||
- image: mobify/apns-http2-mock-server | ||
working_directory: ~/app | ||
environment: | ||
MIX_ENV: << parameters.env >> | ||
|
||
commands: | ||
test: | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- mix-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
- restore_cache: | ||
keys: | ||
- build-${CIRCLE_JOB}-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
- run: | ||
name: Wait for FCM mock | ||
command: dockerize -wait tcp://localhost:443 -timeout 1m | ||
- run: | ||
name: Wait for APNS mock | ||
command: dockerize -wait tcp://localhost:2197 -timeout 1m | ||
|
||
- run: MIX_ENV=test mix do certs.dev, coveralls.circle | ||
|
||
- save_cache: | ||
key: build-${CIRCLE_JOB}-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
paths: | ||
- "_build" | ||
- store_artifacts: | ||
path: cover | ||
destination: coverage_results | ||
|
||
jobs: | ||
pre-build: | ||
executor: elixir-builder | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: mix local.hex --force | ||
- run: mix local.rebar --force | ||
|
||
- run: mix deps.get | ||
- run: echo "$OTP_VERSION $ELIXIR_VERSION" > .version_file | ||
- save_cache: | ||
key: mix-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
paths: | ||
- deps | ||
- ~/.mix | ||
|
||
|
||
dialyzer: | ||
executor: elixir-builder | ||
|
||
steps: | ||
- checkout | ||
- run: echo "$OTP_VERSION $ELIXIR_VERSION" > .version_file | ||
- restore_cache: | ||
keys: | ||
- mix-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
- restore_cache: | ||
keys: | ||
- plt-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ checksum ".version_file" }}-{{ checksum "mix.lock" }} | ||
- plt-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ checksum ".version_file" }} | ||
- run: mix dialyzer --plt | ||
- save_cache: | ||
key: plt-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ checksum ".version_file" }}-{{ checksum "mix.lock" }} | ||
paths: | ||
- .dialyzer | ||
- _build | ||
- save_cache: | ||
key: plt-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ checksum ".version_file" }} | ||
paths: | ||
- .dialyzer | ||
- run: | ||
name: Execute dialyzer | ||
command: mix deps.get && mix dialyzer --halt-exit-status | ||
|
||
release: | ||
executor: | ||
name: elixir-builder | ||
env: prod | ||
|
||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- mix-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
- restore_cache: | ||
keys: | ||
- release-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
- run: mix do certs.dev, distillery.release | ||
- run: tar -czf mongoose_push.tar.gz -C _build/${MIX_ENV}/rel/mongoose_push . | ||
- save_cache: | ||
key: release-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
paths: | ||
- "_build" | ||
- "mongoose_push.tar.gz" | ||
|
||
|
||
test-erlang-22_elixir-1-9: | ||
executor: | ||
name: elixir-builder | ||
env: test | ||
erlang_version: "22.0" | ||
elixir_version: "1.9" | ||
|
||
steps: | ||
- test | ||
|
||
test-erlang-22_elixir-1-8: | ||
executor: | ||
name: elixir-builder | ||
env: test | ||
erlang_version: "22.0" | ||
elixir_version: "1.8" | ||
|
||
steps: | ||
- test | ||
|
||
test-erlang-22_elixir-1-7: | ||
executor: | ||
name: elixir-builder | ||
env: test | ||
erlang_version: "22.0" | ||
elixir_version: "1.7" | ||
|
||
steps: | ||
- test | ||
|
||
test-erlang-21_elixir-1-9: | ||
executor: | ||
name: elixir-builder | ||
env: test | ||
erlang_version: "21.3" | ||
elixir_version: "1.9" | ||
|
||
steps: | ||
- test | ||
|
||
test-erlang-21_elixir-1-8: | ||
executor: | ||
name: elixir-builder | ||
env: test | ||
erlang_version: "21.3" | ||
elixir_version: "1.8" | ||
|
||
steps: | ||
- test | ||
|
||
test-erlang-21_elixir-1-7: | ||
executor: | ||
name: elixir-builder | ||
env: test | ||
erlang_version: "21.3" | ||
elixir_version: "1.7" | ||
|
||
steps: | ||
- test | ||
|
||
format_check: | ||
executor: | ||
name: elixir-builder | ||
|
||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- mix-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
|
||
- run: mix format --check-formatted | ||
|
||
deploy: | ||
executor: | ||
name: elixir-builder | ||
env: prod | ||
|
||
steps: | ||
- checkout | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- restore_cache: | ||
keys: | ||
- release-cache-{{ .Environment.CACHE_VERSION }}-legacy-{{ .Branch }}-{{ .Revision }} | ||
- run: | ||
name: Generate image tag | ||
command: | | ||
set -x | ||
if [ -n "$CIRCLE_TAG" ]; then | ||
DOCKER_TAG="$CIRCLE_TAG" | ||
elif [ "$CIRCLE_BRANCH" == "master" ]; then | ||
DOCKER_TAG="${CIRCLE_SHA1:0:7}" | ||
else | ||
DOCKER_TAG=`echo $CIRCLE_BRANCH | sed 's,/,_,g'` | ||
fi | ||
env | sort | ||
echo "export DOCKER_TAG=$DOCKER_TAG" >> $BASH_ENV | ||
echo "export DOCKER_IMAGE=mongoose-push" >> $BASH_ENV | ||
- run: | ||
name: Login to DockerHub | ||
command: docker login -u "${DOCKERHUB_USER}" -p "${DOCKERHUB_PASS}" | ||
|
||
- run: | ||
name: Build docker image | ||
command: docker build -f Dockerfile.release --build-arg MIX_ENV=prod -t $DOCKER_IMAGE:$DOCKER_TAG . | ||
- run: | ||
name: Tag and push docker image | ||
command: | | ||
set -x | ||
docker tag $DOCKER_IMAGE:$DOCKER_TAG $DOCKERHUB_REPOSITORY/$DOCKER_IMAGE:$DOCKER_TAG | ||
docker push $DOCKERHUB_REPOSITORY/$DOCKER_IMAGE:$DOCKER_TAG | ||
if [ "$CIRCLE_BRANCH" == "master" ]; then | ||
docker tag $DOCKER_IMAGE:$DOCKER_TAG $DOCKERHUB_REPOSITORY/$DOCKER_IMAGE:latest | ||
docker push $DOCKERHUB_REPOSITORY/$DOCKER_IMAGE:latest | ||
echo "Image has been pushed as: '$DOCKERHUB_REPOSITORY/$DOCKER_IMAGE:latest'" | ||
fi | ||
echo "Image has been pushed as: '$DOCKERHUB_REPOSITORY/$DOCKER_IMAGE:$DOCKER_TAG'" | ||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- pre-build: | ||
filters: *all_tags | ||
- format_check: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
|
||
- test-erlang-22_elixir-1-9: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
- test-erlang-22_elixir-1-8: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
- test-erlang-22_elixir-1-7: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
- test-erlang-21_elixir-1-9: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
- test-erlang-21_elixir-1-8: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
- test-erlang-21_elixir-1-7: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
|
||
- release: | ||
requires: | ||
- pre-build | ||
filters: *all_tags | ||
- deploy: | ||
requires: | ||
- test-erlang-22_elixir-1-9 | ||
- release | ||
filters: *all_tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
~r/unmatched_return/, | ||
~r/Function :asn1ct.compile\/2 does not exist/, | ||
~r/lib\/mix\//, | ||
{"lib/mongoose_push/router.ex"}, | ||
{"test/support/api.ex"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.