-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
97 lines (89 loc) · 2.08 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
stages:
- test
- bundle
- package
- deploy
variables:
AWS_DEFAULT_OUTPUT: text
AWS_DEFAULT_REGION: eu-west-1
AWS_REGION: eu-west-1
SAM_CLI_TELEMETRY: 0
.cache_template:
cache:
key: ${CI_PIPELINE_ID}
paths:
- ./node_modules/
test-code:
extends: .cache_template
image: public.ecr.aws/sam/build-nodejs18.x
stage: test
parallel:
matrix:
- AUDIENCE: https://api.cimpress.io/
ISSUERS:
- https://auth0.cimpress.io/
- https://cimpress.auth0.com/,https://auth0.cimpress.io/
- https://cimpress.auth0.com/, https://auth0.cimpress.io/
before_script:
- npm ci
script:
- npm run test -- --ci --testResultsProcessor='jest-junit'
cache:
policy: push
artifacts:
reports:
junit: ./junit.xml
test-template:
image: public.ecr.aws/sam/build-provided.al2
stage: test
before_script:
- pip install --quiet cfn-lint
script:
- sam validate
- cfn-lint --template ./template.yaml --format junit > ./template.cfn-lint.xml
artifacts:
reports:
junit: ./template.cfn-lint.xml
bundle:
extends: .cache_template
image: public.ecr.aws/sam/build-nodejs18.x
stage: bundle
script:
- npm run bundle -- --mode=production
cache:
policy: pull
artifacts:
paths:
- ./dist/
bucket:
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base
stage: bundle
script:
- export BUCKET="$(aws cloudformation list-exports --query "Exports[?Name=='DeploymentBucket'].Value")"
- echo "BUCKET=${BUCKET}" >>./bucket.env
artifacts:
reports:
dotenv: ./bucket.env
package:
image: public.ecr.aws/sam/build-provided.al2
stage: package
script:
- >-
sam package
--s3-bucket "${BUCKET}"
--s3-prefix "${CI_PROJECT_NAME}"
>./template.out.yml
artifacts:
paths:
- ./template.out.yml
deploy:
image: public.ecr.aws/sam/build-provided.al2
stage: deploy
variables:
# This component publishes to us-east-1.
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
script:
- sam publish --template-file ./template.out.yml
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH