-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitbucket-pipelines.yml
94 lines (89 loc) · 3.13 KB
/
bitbucket-pipelines.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
image: 3sidedcube/php:7.4
definitions:
services:
db:
image: mysql:8.0.23
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: preparecenter
MYSQL_USER: preparecenter
MYSQL_PASSWORD: preparecenter
stats_db:
image: mysql:8.0.23
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: usage_logs
MYSQL_USER: preparecenter
MYSQL_PASSWORD: preparecenter
pipelines:
branches:
"{feature/*,bugfix/*,hotfix/*,develop,main}":
- step:
name: "Install Composer dependencies"
caches:
- composer
script:
- "composer self-update"
- "composer install --ignore-platform-reqs"
- "cp .env.bitbucket-pipelines .env"
- "php artisan key:generate"
artifacts:
- "vendor/**"
- ".env"
- step:
name: "Run the test suite"
size: 2x
services:
- db
script:
- "sleep 15"
- php artisan migrate --seed
- php artisan serve &
# Planning to integrate PHPCSFixer but not until the codebase is up-to-date, there's a lot of code that will fail linting at the moment
# - "vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no"
- "vendor/bin/phpunit --verbose"
custom:
deploy-to-staging:
- step:
name: Install PHP dependencies
image: composer:2
caches:
- composer
artifacts:
- vendor/**
script:
- composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader
- step:
name: Deploy
script:
- ssh-keyscan -H bitbucket.org >> ~/.ssh/known_hosts
- cat deploy_known_hosts >> ~/.ssh/known_hosts
- (umask 077; echo $DEPLOY_SSH_KEY | base64 -d > ~/.ssh/id_rsa)
- tar -czf ~/rcnapi-release.tar.gz .
- scp ~/rcnapi-release.tar.gz [email protected]:/home/rcnapi
- ssh -T [email protected] <deploy-staging.sh
deploy-to-production:
- step:
name: Install PHP dependencies
image: composer:2
caches:
- composer
artifacts:
- vendor/**
script:
- composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader
- step:
name: Deploy
script:
- ssh-keyscan -H bitbucket.org >> ~/.ssh/known_hosts
- cat deploy_known_hosts >> ~/.ssh/known_hosts
- (umask 077; echo $DEPLOY_SSH_KEY | base64 -d > ~/.ssh/id_rsa)
- tar -czf ~/rcnapi-release.tar.gz .
- scp ~/rcnapi-release.tar.gz [email protected]:/home/ubuntu
- ssh -T [email protected] < deploy-production.sh
get-known-host:
- step:
name: Get known host value
script:
- ssh-keyscan -H 52.208.98.220 >> ~/.ssh/known_hosts
- cat ~/.ssh/known_hosts