-
Notifications
You must be signed in to change notification settings - Fork 5
138 lines (117 loc) · 4.75 KB
/
application.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
on:
push:
branches:
- master
- dev
pull_request: ~
name: Test & Deploy
env:
REPO_LOWERCASE: armaforces/website
COMPOSE_DOCKER_CLI_BUILD: 1
jobs:
qa:
name: Code Quality & Tests
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Pull app image
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} --password-stdin docker.pkg.github.com
docker pull docker.pkg.github.com/${REPO_LOWERCASE}/app_assets:dev
docker pull docker.pkg.github.com/${REPO_LOWERCASE}/app_php:dev
- name: Start stack
run: |
docker compose -f docker-compose.test.yml up --wait
docker compose exec -T php composer install
- name: Setup database
run: |
make db env=test
- name: Run lint
run: |
docker compose exec -T php bin/console cache:warmup --env=dev
make cs env=test ci=true
- name: Run tests
run: |
make test-ci
- name: Failure logs
if: failure()
run: |
docker compose logs php
docker compose logs mysql
docker_release:
name: Docker release
runs-on: ubuntu-latest
needs: qa
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') && github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v1
- name: Login to registry
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY_URL: docker.pkg.github.com
- name: Create VERSION
run: echo $GITHUB_SHA > VERSION
- name: Build Assets
if: github.ref == 'refs/heads/dev'
run: docker build -t docker.pkg.github.com/${REPO_LOWERCASE}/app_assets:${IMAGE_TAG}
--target armaforces_web_assets -f .docker/Dockerfile .
- name: Build PHP
if: success()
run: docker build -t docker.pkg.github.com/${REPO_LOWERCASE}/app_php:${IMAGE_TAG}
--target armaforces_web_php -f .docker/Dockerfile .
- name: Build Nginx
if: success()
run: docker build -t docker.pkg.github.com/${REPO_LOWERCASE}/app_nginx:${IMAGE_TAG}
--target armaforces_web_nginx -f .docker/Dockerfile .
- name: Push Assets
if: github.ref == 'refs/heads/dev'
uses: actions-hub/docker@master
with:
args: push docker.pkg.github.com/${REPO_LOWERCASE}/app_assets:${IMAGE_TAG}
- name: Push PHP
if: success()
uses: actions-hub/docker@master
with:
args: push docker.pkg.github.com/${REPO_LOWERCASE}/app_php:${IMAGE_TAG}
- name: Push Nginx
if: success()
uses: actions-hub/docker@master
with:
args: push docker.pkg.github.com/${REPO_LOWERCASE}/app_nginx:${IMAGE_TAG}
deploy_dev:
name: Deploy development
runs-on: ubuntu-latest
needs: docker_release
environment:
name: development
url: https://dev.armaforces.com
if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request'
steps:
- name: Update Dev Env PHP
uses: wei/curl@v1
with:
args: -X POST ${{ secrets.WEBHOOK_UPDATE_PHP_DEV }}
- name: Update Dev Env Nginx
uses: wei/curl@v1
with:
args: -X POST ${{ secrets.WEBHOOK_UPDATE_NGINX_DEV }}
deploy_prod:
name: Deploy production
runs-on: ubuntu-latest
needs: docker_release
environment:
name: production
url: https://armaforces.com
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
steps:
- name: Update Prod Env PHP
uses: wei/curl@v1
with:
args: -X POST ${{ secrets.WEBHOOK_UPDATE_PHP_PROD }}
- name: Update Prod Env Nginx
uses: wei/curl@v1
with:
args: -X POST ${{ secrets.WEBHOOK_UPDATE_NGINX_PROD }}