This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
193 lines (193 loc) · 9.36 KB
/
.travis.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
dist: xenial
language: node_js
os:
- linux
- osx
- windows
arch:
- amd64
- arm64
node_js:
- 14
- 12
- 10
cache:
directories:
- node_modules
- frontend/node_modules
stages:
- lint
- test
- integration
addons:
chrome: stable
services:
- docker
install:
- if [[ -z "$TRAVIS_TAG" ]]; then npm install; fi
script: if [[ -z "$TRAVIS_TAG" && "$TRAVIS_OS_NAME" != "windows" && "$TRAVIS_CPU_ARCH"
== "amd64" ]]; then NODE_ENV=test npm test; fi
before_deploy:
- npm install --production
- npm install -g grunt-cli
- npm run package:ci
deploy:
- provider: releases
overwrite: true
token:
secure: fHybcH65ZdS5ITVKH2tIVBITVSiRQJ1AuWqLP16gyAz5pdmWbLM5gA/74zCozanRmuB+7pGFbhDNm075JWoEDVrWSFDLnNiXvfgUYa4oVEiWZlLvOfSARaU3AQPlVvFVhIbG9SA5IEwTtNFbyHjqLjGn/DSBpiIDqqxhF57vw7Q=
file: dist/*
file_glob: true
draft: true
tag_name: "$TRAVIS_TAG"
on:
repo: bkimminich/juice-shop
tags: true
edge: true
jobs:
include:
- stage: lint
if: tag IS blank
install: npm i -g standard@14 && npm i -g yaml-schema-validator && cd frontend
&& npm install && cd ..
script:
- npm run lint
- npm run lint:config -- -f ./config/7ms.yml
- npm run lint:config -- -f ./config/addo.yml
- npm run lint:config -- -f ./config/bodgeit.yml
- npm run lint:config -- -f ./config/ctf.yml
- npm run lint:config -- -f ./config/default.yml
- npm run lint:config -- -f ./config/fbctf.yml
- npm run lint:config -- -f ./config/juicebox.yml
- npm run lint:config -- -f ./config/mozilla.yml
- npm run lint:config -- -f ./config/quiet.yml
- npm run lint:config -- -f ./config/tutorial.yml
- npm run lint:config -- -f ./config/unsafe.yml
- stage: integration
if: tag IS blank
env:
- secure: KBx27d+h4Aa1vsRG1/gBxIFgee5N4Ln9rf1hmCcpHYp+9A+qspXpJRGm8Loy1dF+NhfY0POnQshAzOgG2isv7/CnNIJmWjHLXwqNvMkKpl2EDbl7EGBGByjvR9K9A84rn7BJJAEsb0/6NNofLhvhheL5mxd1SYvdlbewYeyg3dU=
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
> ./cc-test-reporter
- chmod +x ./cc-test-reporter
script:
- export NODE_ENV=test
- npm test
- npm run frisby
after_success:
- "./cc-test-reporter format-coverage -t lcov -o build/reports/coverage/codeclimate.frontend.json
build/reports/coverage/frontend-tests/lcov.info"
- "./cc-test-reporter format-coverage -t lcov -o build/reports/coverage/codeclimate.server.json
build/reports/coverage/server-tests/lcov.info"
- "./cc-test-reporter format-coverage -t lcov -o build/reports/coverage/codeclimate.api.json
build/reports/coverage/api-tests/lcov.info"
- "./cc-test-reporter sum-coverage build/reports/coverage/codeclimate.*.json -p
3"
- "./cc-test-reporter upload-coverage"
- stage: e2e
if: tag IS blank
script:
- export NODE_ENV=test
- npm run protractor
- stage: e2e
if: tag IS blank
script:
- export NODE_ENV=test
- npm run preprotractor
- npm run e2e -- subfolder
- stage: smoke
if: tag IS blank
before_install:
- chmod +x test/smoke/smoke-test.sh
install:
- npm install --production
- npm install -g grunt-cli
- npm run package:ci
script:
- cd dist
- tar -zxf juice-shop-*.tgz
- cd juice-shop_*
- npm start &
- "../../test/smoke/smoke-test.sh http://localhost:3000"
- stage: deploy
if: "(branch = master OR branch = develop OR branch = gsoc2020) AND NOT type =
pull_request"
install: skip
script: skip
before_deploy:
- npm install --production
deploy:
- provider: heroku
strategy: api
api_key:
secure: faVT3Ne/O7lVo0+pTm6RcXss0ivvSoODaxMkiVwdpk/51/EsRd4+/Gjmp3RGPmW5H5luOephsI8uFMMhgKiu5i3NV58ZSx29Z0aby+bfIhesZGZqJQvxeW8B0J8vlQFnEHP6xc6SAlXSdNjNpDeBaV7WSFSGKGp4Nh5QyO2ySLI=
app:
master: juice-shop
develop: juice-shop-staging
gsoc2020: juice-shop-gsoc
on:
repo: bkimminich/juice-shop
edge: true
- stage: docker
arch: amd64
env:
- secure: Tyoy/YPivlB0aVnkkBRa2BRshwhdPqC6TY+OE5u6fLHD/AconqyonKhFYSRDiYH8l5+bTbuPhWZ5NJATUm4k4mCTp9bIAQLrfGe5ws7rSGPBh4ohOItPXahNAUdTRhwJlOnzNkmTVdONhhCLhMceTlVNbU0c9rSTdRZF6LVN1Hk=
if: "((branch = master OR branch = develop) AND NOT type = pull_request) OR tag IS NOT blank"
install:
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t bkimminich/juice-shop:latest-amd64 .; fi
- if [[ "$TRAVIS_BRANCH" == "develop" ]]; then docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t bkimminich/juice-shop:snapshot-amd64 .; fi
- if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t bkimminich/juice-shop:$TRAVIS_TAG-amd64 .; fi
script:
- if [[ "$TRAVIS_BRANCH" == "develop" ]]; then sed -i 's/latest/snapshot/g' docker-compose.test.yml; fi
- if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then sed -i 's/latest/'"$TRAVIS_TAG"'/g' docker-compose.test.yml; fi
- docker-compose -f docker-compose.test.yml up --no-recreate --exit-code-from sut
after_success:
- echo "$DOCKER_ACCESS_TOKEN" | docker login -u bkimminich --password-stdin
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then docker push bkimminich/juice-shop:latest-amd64; fi
- if [[ "$TRAVIS_BRANCH" == "develop" ]]; then docker push bkimminich/juice-shop:snapshot-amd64; fi
- if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then docker push bkimminich/juice-shop:$TRAVIS_TAG-amd64; fi
# - stage: docker
# arch: arm64
# env:
# - secure: Tyoy/YPivlB0aVnkkBRa2BRshwhdPqC6TY+OE5u6fLHD/AconqyonKhFYSRDiYH8l5+bTbuPhWZ5NJATUm4k4mCTp9bIAQLrfGe5ws7rSGPBh4ohOItPXahNAUdTRhwJlOnzNkmTVdONhhCLhMceTlVNbU0c9rSTdRZF6LVN1Hk=
# if: "((branch = master OR branch = develop) AND NOT type = pull_request) OR tag IS NOT blank"
# install:
# - if [[ "$TRAVIS_BRANCH" == "master" ]]; then docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t bkimminich/juice-shop:latest-arm64v8 .; fi
# - if [[ "$TRAVIS_BRANCH" == "develop" ]]; then docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t bkimminich/juice-shop:snapshot-arm64v8 .; fi
# - if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t bkimminich/juice-shop:$TRAVIS_TAG-arm64v8 .; fi
# script:
# - if [[ "$TRAVIS_BRANCH" == "master" ]]; then sed -i 's/amd64/arm64v8/g' docker-compose.test.yml; fi
# - if [[ "$TRAVIS_BRANCH" == "develop" ]]; then sed -i 's/latest-amd64/snapshot-arm64v8/g' docker-compose.test.yml; fi
# - if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then sed -i 's/latest-amd64/'"$TRAVIS_TAG"'-arm64v8/g' docker-compose.test.yml; fi
# - docker-compose -f docker-compose.test.yml up --no-recreate --exit-code-from sut
# after_success:
# - echo "$DOCKER_ACCESS_TOKEN" | docker login -u bkimminich --password-stdin
# - if [[ "$TRAVIS_BRANCH" == "master" ]]; then docker push bkimminich/juice-shop:latest-arm64v8; fi
# - if [[ "$TRAVIS_BRANCH" == "develop" ]]; then docker push bkimminich/juice-shop:snapshot-arm64v8; fi
# - if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then docker push bkimminich/juice-shop:$TRAVIS_TAG-arm64v8; fi
- stage: manifest
env:
- secure: Tyoy/YPivlB0aVnkkBRa2BRshwhdPqC6TY+OE5u6fLHD/AconqyonKhFYSRDiYH8l5+bTbuPhWZ5NJATUm4k4mCTp9bIAQLrfGe5ws7rSGPBh4ohOItPXahNAUdTRhwJlOnzNkmTVdONhhCLhMceTlVNbU0c9rSTdRZF6LVN1Hk=
if: "((branch = master OR branch = develop) AND NOT type = pull_request) OR tag IS NOT blank"
install:
- curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64
- chmod +x manifest-tool
script:
- echo "$DOCKER_ACCESS_TOKEN" | docker login -u bkimminich --password-stdin
- if [[ "$TRAVIS_BRANCH" == "develop" ]]; then sed -i 's/latest/snapshot/g' multi-arch-manifest.yaml; fi
- if [[ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then sed -i 's/latest/'"$TRAVIS_TAG"'/g' multi-arch-manifest.yaml; fi
- "./manifest-tool push from-spec multi-arch-manifest.yaml"
notifications:
webhooks:
urls:
- secure: cmxowwRhxwvGeFTyLT7d+xNsrB5JWaolb4rtuXCjbYVvnukaxJDKcKJ1/pyNi5OMu6qkMEVdAgNYE6q3H0TGE1leJmoaoMwIQo5I3GNMLtr4VNASmRupJrWV0Gjamj+3uC6d5iyg0PpeT73fvuUTQ8TNz5696svZtK7FtmwvigU=
on_success: always
on_failure: always
on_start: never
slack:
rooms:
- secure: SpuG3G8p/B0qXmU6snPJ+JmcQoHMg/YmUuv9s0as+FdZquWURfbuOH51BxpiWIWlE23BMVGykQR+T0eKsYQ6cPNHLShaesE1qGJf/hG0tHWRK2fK6d3VTTpwZt6XxR3AGYnpCz8gmUxwMBZ1lESjHhQiQKy2AjFBweTTU2IfQaQ=
on_success: change
on_failure: change
on_pull_requests: false