Last active
June 2, 2023 18:18
-
-
Save garunski/5fcc33604f1547bd6151a99ec20fe1b0 to your computer and use it in GitHub Desktop.
Jenkinsfile with testing and code coverage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/groovy | |
timestamps { | |
podTemplate( | |
label: 'jenkins-pipeline', | |
inheritFrom: 'default', | |
containers: [ | |
containerTemplate(name: 'chrome', image: 'garunski/alpine-chrome:latest', command: 'cat', ttyEnabled: true) | |
] | |
) { | |
node ('jenkins-pipeline') { | |
stage('Get latest version of code') { | |
checkout scm | |
} | |
container ('chrome') { | |
stage('Install Packages') { | |
sh 'npm install --quiet' | |
} | |
stage('Code Formatting checks') { | |
sh 'npm run lint' | |
} | |
stage('Build') { | |
sh 'npm run build' | |
} | |
stage('Run Unit Tests') { | |
sh 'npm run test-ci' | |
junit 'test-results/**/*.xml' | |
} | |
} //end container chrome | |
stage('Run Code Coverage') { | |
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/cobertura.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false | |
} | |
stage('Deploy Local') { | |
} | |
stage('Run Integration Tests') { | |
} | |
stage('Deploy Production') { | |
} | |
stage('Run Post Deployment Tests') { | |
} | |
} // end node | |
} // end podTemplate | |
} // end timestamps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment