-
Notifications
You must be signed in to change notification settings - Fork 26
/
.gitlab-ci.yml
82 lines (78 loc) · 2.37 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
stages:
- build
- test
- deploy
variables:
AWS_DEFAULT_REGION: us-east-1
S3_BUCKET_NAME: wc-demos
CLOUDFRONT_DISTRIBUTION_ID: E2Q51X0UO412XH
AWS_ROLE_ARN: arn:aws:iam::611646686338:role/OxfordRole
GIT_STRATEGY: fetch
GIT_CLEAN_FLAGS: "-xdfq --exclude=build"
NODE_OPTIONS: "--max-old-space-size=8192"
build:
stage: build
tags:
- dsa
- DIND
image: node:20
timeout: 2h
# before_script:
# - apt-get update -y && apt-get install -y libnss3 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 curl
script:
# - uname -a
# - curl http://169.254.169.254/latest/meta-data/instance-type
# - cat /proc/cpuinfo
# - cat /proc/meminfo
# - node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))'
- npm ci
- npm run build
test:
stage: test
tags:
- dsa
- DIND
image: node:20
timeout: 3h
script:
- npm ci
- npm run build:coverage
- npm run lint
- rm -rf .nyc_output
- rm -rf coverage
- npx playwright install chromium --with-deps
# - npx playwright test -- tag
# - ls test-results
- npx playwright test --grep-invert 'percy'
- npx percy exec -- npx playwright test --workers=1 --grep 'percy'
- npx nyc report
coverage: /All files[^\|]*\|[^\|]*\s+([\d\.]+)/
artifacts:
reports:
junit: test-results/junit-results.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
deploy:
stage: deploy
tags:
- dsa
- DIND
before_script:
- 'command -v aws >/dev/null 2>&1 || { echo >&2 "Installing AWS CLI..."; pip install awscli; }'
- >
export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s"
$(aws sts assume-role
--role-arn ${AWS_ROLE_ARN}
--role-session-name "GitLabRunner-${CI_PROJECT_ID}-${CI_PIPELINE_ID}"
--duration-seconds 3600
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]'
--output text))
- aws configure set default.region $AWS_DEFAULT_REGION
image: python:3.12
script:
- branch_name=$(echo $CI_COMMIT_REF_NAME | sed 's/[./-]/_/g')
- echo "Deploying ${branch_name}"
- aws s3 cp build/development/ "s3://${S3_BUCKET_NAME}/${branch_name}" --recursive
- aws configure set preview.cloudfront true
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || true