Skip to content

Commit

Permalink
build: use jest for tests; add sonarqube build step
Browse files Browse the repository at this point in the history
  • Loading branch information
alacambre-yseop committed Apr 24, 2020
1 parent eb3fe7c commit 969ba93
Show file tree
Hide file tree
Showing 21 changed files with 10,098 additions and 880 deletions.
58 changes: 55 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env groovy
@Library('Utilities') _

pipeline {
agent {
node {
Expand All @@ -18,12 +20,34 @@ pipeline {
}

stages {
stage ("Build, Compile, Test and Package") {
stage ("Install dependencies") {
steps {
ansiColor('xterm') {
sh "npm ci --unsafe-perm"
}
}
}

stage ("Compile") {
steps {
ansiColor('xterm') {
sh "npm install --unsafe-perm"
sh "npm run compile"
sh "npm run test"
}
}
}

stage ("Test") {
steps {
ansiColor('xterm') {
sh "npm run test:ci"
sh "npm run test:client"
}
}
}

stage ("Package") {
steps {
ansiColor('xterm') {
sh "npm run package"
}
}
Expand All @@ -33,6 +57,34 @@ pipeline {
}
}
}

stage('SonarQube') {
steps {
script {
def scannerHome = tool 'sonarqube'
def sonarArgs = utils.constructSonarArgs(['develop', 'master'], 'develop')

withSonarQubeEnv('sonarcloud') {
sh "${scannerHome}/bin/sonar-scanner ${sonarArgs}"
}
}
}
}

stage('Sonar Quality Gate') {
when {
anyOf {
branch 'develop'
branch 'master'
}
}
steps {
timeout(time: 1, unit: 'HOURS') {
// Parameter indicates whether to set pipeline to FAILED if Quality Gate fails
waitForQualityGate abortPipeline: true
}
}
}
}

post {
Expand Down
11 changes: 11 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// babel.config.js
module.exports = {
presets: [
["@babel/preset-env", {
targets: {
node: "current",
},
}],
"@babel/preset-typescript",
],
};
Loading

0 comments on commit 969ba93

Please sign in to comment.