-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
122 lines (115 loc) · 2.26 KB
/
.gitlab-ci.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
stages:
- build
- test
- deploy
- performance
# include:
# - template: Jobs/License-Scanning.gitlab-ci.yml
# - template: Security/Dependency-Scanning.gitlab-ci.yml
# - template: Verify/Browser-Performance.gitlab-ci.yml
.build:
image: node:20
stage: build
variables:
YARN_CACHE_FOLDER: .yarn-cache/
cache:
key:
files:
- yarn.lock
paths:
- .yarn-cache/
before_script:
- corepack enable
- yarn install --immutable
script:
- yarn test
- yarn build-$CI_ENVIRONMENT_NAME
- du --bytes --total dist/assets/*js | tail -n1 | awk "{print \"size_${CI_ENVIRONMENT_NAME}_js \" \$1}" >> metrics.txt
artifacts:
paths:
- dist/
reports:
metrics: metrics.txt
.deploy:
stage: deploy
image: alpine:latest
script:
- apk add openssh-client rsync
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- sed 's#<title>Avalanche Bulletin Home</title>#{{placeholder "http.vars.meta"}}#' -i dist/index.html
- rsync -avz -e 'ssh -p2201' --delete dist/ $SFTP_SERVER
build:dev:
extends: .build
environment:
name: dev
deploy:dev:
extends: .deploy
environment:
name: dev
needs:
- build:dev
only:
- master
- ci
deploy:dev:manual:
extends: .deploy
environment:
name: dev
needs:
- build:dev
when: manual
build:beta:
extends: .build
environment:
name: beta
deploy:beta:
extends: .deploy
environment:
name: beta
needs:
- build:beta
only:
- master
- ci
deploy:beta:manual:
extends: .deploy
environment:
name: beta
needs:
- build:beta
when: manual
# browser_performance:
# needs:
# - deploy:beta
# variables:
# URL: https://avalanche.report/beta/
# only:
# - master
# - ci
build:prod:
extends: .build
environment:
name: prod
deploy:prod:
extends: .deploy
environment:
name: prod
needs:
- build:prod
only:
- tags
when: manual
playwright:
extends: .build
image: mcr.microsoft.com/playwright:v1.44.1-focal
artifacts:
when: always
paths:
- playwright-report/
- test-results/
script:
- yarn playwright test
when: manual