forked from Makpar-Innovation-Laboratory/react-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildspec.yml
60 lines (55 loc) · 1.71 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
50
51
52
53
54
55
56
57
58
59
60
version: 0.2
phases:
install:
runtime-versions:
nodejs: 14
commands:
# Initialize environment
- |
if [ "${BRANCH}" != prod ]
then
export ENV="-${BRANCH}"
else
export ENV=""
fi
# Install Dependencies
- cd frontend && npm install
# # Download Sonar Scanner CLI
# - |
# curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip \
# -o "sonar_scanner.zip"
# unzip sonar_scanner.zip > /dev/null 2>&1
# export PATH=$(pwd)/sonar-scanner-4.6.2.2472-linux/bin/:$PATH
pre_build:
commands:
# Linting
- npm run lint
# Unit Tests
- |
npm run test:report || true
aws s3 cp ./reports/istanbul-coverage/lcov-report/. \
s3://${APPLICATION}-documentation-web/test-coverage/frontend \
--recursive
# # SonarQube Static Code Analysis
# - |
# sonar-scanner \
# -Dsonar.projectKey=${APPLICATION}-frontend${ENV} \
# -Dsonar.sources=./src/ \
# -Dsonar.host.url=http://$SONAR_URL:9000 \
# -Dsonar.login=$SONAR_TOKEN \
# -Dsonar.log.level=DEBUG \
# -Dsonar.exclusions=**/*.json,**/*.css,**/*.test.js,**/*.svg \
# -Dsonar.sources=$(pwd)/src \
# -Dsonar.sourceEncoding=UTF-8
# # -Dsonar.coverageReportPaths=path/to/coverage.xml
# # see: https://docs.sonarqube.org/latest/analysis/coverage/
build:
commands:
- |
npm run build
aws s3 cp ./build/. \
s3://${APPLICATION}-laboratory${ENV}-web \
--recursive
cache:
path:
- frontend/node_modules