forked from Connected-Places/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
73 lines (61 loc) · 2.19 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
71
72
73
os: linux
dist: focal
branches:
only:
# Tagged releases
- /^[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.[0-9]+$/
# Master
- master
# Develop
- develop
language: python
python:
- "3.8"
services:
- docker
before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
before_script:
- if [ ! -z "$DOCKER_USER" ] && [ ! -z "$DOCKER_PWD" ]; then echo ${DOCKER_PWD} | docker login --username ${DOCKER_USER} --password-stdin; fi
- sudo service mysql stop
- ./develop build
- ./develop up -d
- ./develop npm ci
- ./develop npm run dev
- ./develop composer install
- ./develop run --rm -T app mv .env.example .env
- ./develop artisan key:generate
- ./develop artisan passport:keys
script:
- ./develop composer test:style
- ./develop composer test:unit
after_failure:
- cat storage/logs/testing.log
before_deploy: |
if ! [[ ${HAS_RAN_BEFORE_DEPLOY} ]]; then
export HAS_RAN_BEFORE_DEPLOY="TRUE"
echo "Compiling assets for production..."
./develop npm run prod
echo "Installing AWS CLI..."
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
echo aws --version
fi
deploy:
# Tagged releases
- provider: script
script: ENVIRONMENT=production REPO_URI=$REPO_URI_PRODUCTION CLUSTER=$CLUSTER_PRODUCTION AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_PRODUCTION AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_PRODUCTION AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION_PRODUCTION bash .travis/deploy.sh
skip_cleanup: true
on:
all_branches: true
condition: ${TRAVIS_TAG} =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.[0-9]+$
# Develop
- provider: script
script: ENVIRONMENT=staging REPO_URI=$REPO_URI_STAGING CLUSTER=$CLUSTER_STAGING AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_STAGING AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_STAGING AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION_STAGING bash .travis/deploy.sh
skip_cleanup: true
on:
branch: develop