Create Pipeline in Jenkins - konlawatit/SWDEV-BBP-PLUS GitHub Wiki

1. Frontend pipeline

Script

pipeline {
agent any

stages {
    stage('Pull Code') {
        steps {
            git branch: 'main', url: 'https://github.com/konlawatit/SWDEV-BBP-PLUS'
        }
    }
    stage('Download dependency') {
        steps {
            sh 'cd frontend && npm install'
        }
    }
    stage('Unit Testing') {
        steps {
            sh 'cd frontend && npm run unit-test'
        }
    }
    stage('Component Testing') {
        steps {
            sh 'cd frontend && npm run component-test'
        }
    }
    stage('End-To-End Testing') {
        steps {
            sh 'cd frontend && npm run e2e-test || exit 0'
        }
    }
    stage('Build') {
        steps {
            sh 'cd frontend && npm run build'
        }
    }
    stage('Deployment') {
        steps {
            echo '---------------------------- Deployment ----------------------------'
            // sh ''
        }
    }
  }
}

2. Backend pipeline

Script

pipeline {
agent any

stages {
    stage('Pull Code') {
        steps {
            git branch: 'main', url: 'https://github.com/konlawatit/SWDEV-BBP-PLUS'
        }
    }
    stage('Download dependency') {
        steps {
            sh 'cd backend && npm install'
        }
    }
    stage('Unit Testing') {
        steps {
            sh 'cd backend && npm run unit-test'
        }
    }
    stage('Unit Testing Report') {
        steps {
            sh 'cd backend && npm run unit-test-report'
        }
    }
    stage('Component Testing') {
        steps {
            sh 'cd backend && npm run component-test-report'
        }
    }
    stage('Component Testing Report') {
        steps {
            sh 'cd backend && npm run component-test-report'
        }
    }
    stage('Create Coverage Report') {
        steps {
            echo 'code coverage report'
            // sh ''
        }
    }
  }
}