This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
70 lines (56 loc) · 2.76 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
70
RAILS_ENV?=development
HEROKU_APP?=soundstorm-social
# Build the Docker image for the current environment.
all:
@docker-compose -f docker-compose.yml -f docker-compose.$(RAILS_ENV).yml build web
# Set up the database in the Docker environment
install:
@docker-compose -f docker-compose.yml -f docker-compose.$(RAILS_ENV).yml run --rm web bin/rails db:setup elasticsearch
# Run all tests
test:
@docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm web bin/rails test test/**/*_test.rb
check: test
bin/cc-test-reporter:
@curl https://s3.amazonaws.com/codeclimate/test-reporter/test-reporter-latest-linux-amd64 -o bin/cc-test-reporter
@chmod +x bin/cc-test-reporter
# Run tests in CI with CodeClimate test coverage reporting
ci: bin/cc-test-reporter
@docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm web bin/ci.sh
# Deploy https://soundstorm.social to Heroku
deploy: /usr/local/bin/heroku
@docker build -t registry.heroku.com/${HEROKU_APP}/worker -f Dockerfile.worker .
@docker tag weathermen/soundstorm:latest registry.heroku.com/${HEROKU_APP}/web
@docker push registry.heroku.com/${HEROKU_APP}/web
@docker push registry.heroku.com/${HEROKU_APP}/worker
@heroku container:release web worker -a ${HEROKU_APP}
@heroku run rails db:migrate -a ${HEROKU_APP}
# Provision a new app on Heroku
provision: /usr/local/bin/heroku pull
@docker build -t registry.heroku.com/${HEROKU_APP}/worker -f Dockerfile.worker .
@docker tag weathermen/soundstorm:latest registry.heroku.com/${HEROKU_APP}/web
@docker push registry.heroku.com/${HEROKU_APP}/web
@docker push registry.heroku.com/${HEROKU_APP}/worker
@heroku container:release web worker -a ${HEROKU_APP}
@heroku run rails db:schema:load db:seed elasticsearch cors -a ${HEROKU_APP}
# Release a tagged version to Docker Hub
dist:
@docker tag weathermen/soundstorm:latest weathermen/soundstorm:${TRAVIS_TAG}
@docker push weathermen/soundstorm:${TRAVIS_TAG}
# Remove all containers, volumes, and images associated with this
# installation of Soundstorm
clean:
@docker-compose -f docker-compose.yml -f docker-compose.$(RAILS_ENV).yml down --remove-orphans --volumes --rmi all
@rm bin/cc-test-reporter
# Remove all containers and volumes associaed with this installation of
# Soundstorm
mostlyclean:
@docker-compose -f docker-compose.yml -f docker-compose.$(RAILS_ENV).yml down --remove-orphans --volumes
# Remove all production images built by `dist`
distclean:
@docker image rm weathermen/soundstorm:latest weathermen/soundstorm:$(TRAVIS_TAG)
# Generate CTags for the Soundstorm codebase
tags:
@ctags -R .
/usr/local/bin/heroku:
@curl https://cli-assets.heroku.com/install.sh | sh
.PHONY: all database ci-before test check ci-after ci deploy dist clean distclean mostlyclean push pull ci ci-setup ci-report