forked from cypress-io/cypress-example-kitchensink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
49 lines (47 loc) · 1.8 KB
/
buildspec.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
version: 0.2
# AWS CodeBuild Batch configuration
# https://docs.aws.amazon.com/codebuild/latest/userguide/batch-build-buildspec.html
# Define 5 parallel builds to run using the "build-matrix"
build-matrix:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
dynamic:
env:
variables:
WORKERS:
- 1
- 2
- 3
- 4
- 5
# Optional: Use Custom Public ECR Image as container
#image:
# - public.ecr.aws/your-namespace/image-name
phases:
install:
runtime-versions:
nodejs: latest
commands:
# Set COMMIT_INFO variables to send Git specifics to Cypress Dashboard when recording
# https://docs.cypress.io/guides/continuous-integration/introduction#Git-information
- export COMMIT_INFO_BRANCH="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')"
- export COMMIT_INFO_MESSAGE="$(git log -1 --pretty=%B)"
- export COMMIT_INFO_EMAIL="$(git log -1 --pretty=%ae)"
- export COMMIT_INFO_AUTHOR="$(git log -1 --pretty=%an)"
- export COMMIT_INFO_SHA="$(git log -1 --pretty=%H)"
- export COMMIT_INFO_REMOTE="$(git config --get remote.origin.url)"
- npm ci
pre_build:
commands:
- npm run cy:verify
- npm run cy:info
build:
# Per https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
# use $CODEBUILD_INITIATOR as it provides the entity that started the build
# which is unique and can be used as the --ci-build-id for the Cypress Dashboard
# e.g. awsCodeBuild-cypress-kitchen-sink/AWSCodeBuild-a14fc8e3-b5d6-42f9-9067-345d48a8f0fd
commands:
- npm run start:ci &
- npx cypress run --record --parallel --ci-build-id $CODEBUILD_INITIATOR