-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathMakefile
69 lines (52 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Is there a better way to do this? (kevsmith 12/4/2015)
GENERATED_FILES := deps/piper/lib/piper/permissions/piper_rule_lexer.erl \
deps/piper/lib/piper/permissions/piper_rule_parser.erl
.DEFAULT_GOAL := run
ifdef BUILDKITE_BUILD_NUMBER
# TEST_DATABASE_URL is set in Buildkite; it points to an Amazon RDS
# PostgreSQL instance we use
TEST_DATABASE_URL := $(TEST_DATABASE_URL).$(BUILDKITE_BUILD_NUMBER)
endif
DOCKER_IMAGE ?= operable/cog:0.5-dev
ci: export DATABASE_URL = $(TEST_DATABASE_URL)
ci: export MIX_ENV = test
ci: ci-setup test-all ci-cleanup
ci-reset:
@echo "Resetting build environment"
@rm -rf _build
ci-setup: ci-reset
# Nuke mnesia dirs so we don't get borked on emqttd upgrades
rm -rf Mnesia.* $(GENERATED_FILES) deps
mix deps.get
ci-cleanup:
mix ecto.drop
setup:
mix deps.get
mix ecto.create
mix ecto.migrate
# Note: 'run' does not reset the database, in case you have data
# you're actively using. If this is your first time, run `make
# reset-db` before executing this recipe.
run:
iex -S mix phoenix.server
reset-db:
mix ecto.reset --no-start
test-rollbacks: export MIX_ENV = test
test-rollbacks: reset-db
mix do ecto.rollback --all, ecto.drop
test: export MIX_ENV = test
test: reset-db
mix test $(TEST)
test-all: export MIX_ENV = test
test-all: reset-db
mix test
test-watch: export MIX_ENV = test
test-watch: reset-db
mix test.watch $(TEST)
coverage: export MIX_ENV = test
coverage: reset-db
coverage:
mix coveralls.html
docker:
docker build -t $(DOCKER_IMAGE) .
.PHONY: ci ci-setup ci-cleanup test docker