forked from pagopa/pn-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonar_buildspec.yaml
32 lines (32 loc) · 1.39 KB
/
sonar_buildspec.yaml
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
version: 0.2
env:
shell: bash
secrets-manager:
SONAR_TOKEN: arn:aws:secretsmanager:eu-central-1:911845998067:secret:SonarCloud-7370vM:token
phases:
install:
runtime-versions:
nodejs: 16
commands:
#install yarn
- echo installing yarn
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- apt install --no-install-recommends yarn
pre_build:
commands:
- echo launching yarn install in $SUB_PRJ_NAME...
- cd $SUB_PRJ_NAME
- yarn install --frozen-lockfile
build:
commands:
- echo Running tests with coverage...
- yarn test:coverage
- BRANCH_NAME=$(echo $CODEBUILD_WEBHOOK_HEAD_REF | sed 's/refs\/heads\///'); export BRANCH_NAME=${BRANCH_NAME:=$GIT_DEFAULT_BRANCH}
- if echo $CODEBUILD_SOURCE_VERSION | grep -q ^pr/ ; then PR_NUM=$(echo $CODEBUILD_SOURCE_VERSION | sed 's/pr\///'); BRANCH_TARGET=$(echo $CODEBUILD_WEBHOOK_BASE_REF | sed 's/refs\/heads\///'); export PR_NUM BRANCH_TARGET; fi;
- echo Running sonar task...
- yarn run sonar
# - sleep 5
# - curl https://sonarcloud.io/api/qualitygates/project_status?projectKey=$Project >result.json
# - cat result.json
# - if [ $(jq -r '.projectStatus.status' result.json) = ERROR ] ; then $CODEBUILD_BUILD_SUCCEEDING -eq 0 ;fi