50 lines
977 B
Groovy
50 lines
977 B
Groovy
pipeline {
|
|
agent any
|
|
|
|
options {
|
|
disableConcurrentBuilds()
|
|
timeout(time: 5, unit: 'MINUTES')
|
|
buildDiscarder(logRotator(numToKeepStr: '5'))
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
checkout scm
|
|
}
|
|
}
|
|
|
|
stage('Verify Node.js') {
|
|
steps {
|
|
sh 'node --version'
|
|
sh 'npm --version'
|
|
}
|
|
}
|
|
|
|
stage('Syntax Check') {
|
|
steps {
|
|
dir('app') {
|
|
sh 'npm run check'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Automated Tests') {
|
|
steps {
|
|
dir('app') {
|
|
sh 'npm test'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
echo 'CI PASSED: All checks completed successfully.'
|
|
}
|
|
failure {
|
|
echo 'CI FAILED: Review the Jenkins console output.'
|
|
}
|
|
}
|
|
}
|