-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
97 lines (91 loc) · 2.47 KB
/
.gitlab-ci.yml
File metadata and controls
97 lines (91 loc) · 2.47 KB
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
stages:
- build
- test
- deploy
- review
- dast
- staging
- canary
- production
- incremental rollout 10%
- incremental rollout 25%
- incremental rollout 50%
- incremental rollout 100%
- performance
- release
- cleanup
include:
- template: Auto-DevOps.gitlab-ci.yml
- project: open-source/ci-templates
ref: "main"
file: "/ci/auto-tag-release.gitlab-ci.yml"
sast:
stage: test
code_quality:
image:
name: ghcr.io/realm/swiftlint:latest
pull_policy: if-not-present
script:
- swiftlint lint --reporter codeclimate --output gl-code-quality-report.json
artifacts:
paths: [gl-code-quality-report.json]
test:
image:
name: swift:6.0-noble
pull_policy: if-not-present
stage: test
services:
- postgres:latest
variables:
POSTGRES_USER: vapor_username
POSTGRES_PASSWORD: vapor_password
POSTGRES_ENABLED: "true"
POSTGRES_DB: $CI_COMMIT_SHA
DATABASE_HOST: postgres
DATABASE_USERNAME: $POSTGRES_USER
DATABASE_PASSWORD: $POSTGRES_PASSWORD
DATABASE_NAME: $POSTGRES_DB
script:
- scripts/code_coverage.sh
coverage: '/TOTAL.*\s+(\d+\.\d+)%/'
staging:
dependencies:
- build
stage: staging
script:
- echo $DB_HOST > ansible/templates/database_host
- echo $DB_NAME > ansible/templates/database_name
- echo $DB_PASSWORD > ansible/templates/database_password
- echo $DB_USER > ansible/templates/database_username
- echo $CI_REGISTRY_USER > ansible/templates/username
- echo $CI_REGISTRY_PASSWORD > ansible/templates/password
- echo $SENDGRID_API_KEY > ansible/templates/sendgrid
- ansible-playbook ansible/staging.yml
environment:
name: staging
url: https://api.battletech.dev
rules:
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
tags:
- deploy
production:
dependencies:
- build
stage: production
script:
- echo $DATABASE_HOST > ansible/templates/database_host
- echo $DATABASE_NAME > ansible/templates/database_name
- echo $DATABASE_PASSWORD > ansible/templates/database_password
- echo $DATABASE_USER > ansible/templates/database_username
- echo $CI_REGISTRY_USER > ansible/templates/username
- echo $CI_REGISTRY_PASSWORD > ansible/templates/password
- echo $SENDGRID_API_KEY > ansible/templates/sendgrid
- ansible-playbook ansible/production.yml
environment:
name: production
url: https://api.battletech.games
rules:
- if: "$CI_COMMIT_BRANCH == 'main'"
when: manual
tags:
- deploy