forked from BinaryStudioAcademy/bsa-2019-metrica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
70 lines (70 loc) · 2.59 KB
/
.travis.yml
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
sudo: required
services:
- docker
env:
matrix:
- DOCKER_COMPOSE_VERSION=1.22.0
global:
- PATH=$HOME/.local/bin:$PATH
addons:
hosts:
- site.metrica.fun
cache:
directories:
- frontend/node_modules
- backend/vendor
- test-site/node_modules
before_install:
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- docker-compose -v
- sudo sysctl -w vm.max_map_count=262144
- pip install requests[security]
- pip install --user awscli
- sudo groupadd -g 1000 metrica-group
- sudo usermod -a -G 1000 travis
- $(aws ecr get-login --region ${AWS_REGION} --no-include-email)
- cp backend/.env.travis backend/.env
- cp frontend/.env.travis frontend/.env
- cp test-site/.env.travis test-site/.env
- docker-compose -f docker-compose.test.yml run --rm node npm ci
- docker-compose -f docker-compose.test.yml run --rm test-site npm ci
- docker-compose -f docker-compose.test.yml run --rm test-site npm run build
- docker-compose -f docker-compose.test.yml run --rm node npm run build
- docker-compose -f docker-compose.test.yml run --rm node npm run build:script
- ./.scripts/build.sh app
- ./.scripts/build.sh webserver
script:
- docker-compose -f docker-compose.test.yml up -d
- docker-compose -f docker-compose.test.yml ps
- docker-compose -f docker-compose.test.yml exec app composer install
- docker-compose -f docker-compose.test.yml exec app php artisan key:generate
- docker-compose -f docker-compose.test.yml exec app php artisan jwt:secret
- until curl --silent -XGET --fail http://localhost:9200; do printf '.'; sleep 1; done
- docker-compose -f docker-compose.test.yml exec app php artisan migrate
- docker-compose -f docker-compose.test.yml exec app php artisan db:seed --class=DefaultUserAndWebsiteSeeder
- docker-compose -f docker-compose.test.yml exec app ./vendor/bin/phpunit
- docker-compose -f docker-compose.test.yml run node npm run lint
after_script:
- docker-compose -f docker-compose.test.yml down
- docker image rm -f metrica/app:latest
- docker image rm -f metrica/webserver:latest
- docker rmi -f $(docker images | grep "^<none>" | awk "{print $3}")
- docker images
branches:
only:
- master
- develop
deploy:
- provider: script
skip_cleanup: true
script: "bash .scripts/deploy.sh"
on:
branch: master
- provider: script
skip_cleanup: true
script: "bash .scripts/deploy.sh"
on:
branch: develop