Design Pipeline - trabnm1313/SDTP GitHub Wiki

Frontend

Pipeline Frontend

Frontend-pipeline

Pull Code

pipeline {
    agent any

    stages {
        stage('Pull Code') {
            steps {
                git branch: 'dev', url: 'https://github.com/trabnm1313/SDTP.git'
            }
        }
  • Stage 1 ทำการดึง Code มาจาก Branch main ของโปรเจค

Download Dependencies

stage('Download Dependencies') {
            steps {
                dir("app"){
                    sh 'yarn install'
                }
            }
        }
  • Stage 2 ทำการดาวน์โหลดและติดตั้น Dependencies ต่าง ๆ ของตัวโปรเจค โดยใช้คำสั่ง yarn install

Component Test

stage('Conponents Testing') {
            steps {
                dir("app"){
                    sh 'yarn run components-testing'
                }
            }
        }
  • Stage 3 ทำการทดสอบในรูปแบบของ Component Test โดยใช้คำสั่ง yarn components-testing

Deploy

  • ทำการ Deploy (*ยังไม่มีการ Deploy)

Connect Backend

  • มีการเชื่อมต่อกับฝั่ง Backend

End-to-End Test

stage('E2E Testing') {
            steps {
                dir("app"){
                    echo "E2E mockup"
                }
            }
        }
    }
  • Stage 4 ทำการทดสอบในรูปแบบของ End-to-End Test โดยใช้คำสั่ง yarn e2e_test

Noti

  • Stage 5 ทำการสรุปผลของการทำงานทั้งหมดและแจ้งเตือนให้กับคนในทีม

Backend

Pipeline Backend

Backend-pipeline

Pipeline

pipeline {
    agent any
    environment{
        SECRET_FILE = credentials('team2-secret')
    }
  • Environment เก็บ Credential File สำหรับทำ Component Test

Pull Code

stage('Pull Code') {
    steps {
        git branch: 'feature/backend-jest-testing', url: 'https://github.com/trabnm1313/SDTP.git'
    }
}
  • Stage 1 ทำการดึง Code มาจาก Branch backend-jest-testing ของโปรเจค

Download Dependencies

stage('Download Dependencies') {
    steps {
        dir("app/functions/"){
            sh 'npm install'
        }
    }
}
  • Stage 2 ทำการดาวน์โหลดและติดตั้ง Dependencies ต่าง ๆ ของตัวโปรเจค โดยใช้คำสั่ง npm install

Unit Test

stage('Unit Test') {
    steps {
        dir("app/functions/"){
            sh 'npm run unit_test'
        }
    }
}
  • Stage 3 ทำการทดสอบในรูปแบบของ Unit Test โดยใช้คำสั่ง npm unit_test

Component Test

stage('Component Test') {
    steps {
        dir("app/functions/"){
            sh 'cp ${SECRET_FILE} key.json'
            sh 'npm run component_test'
            sh 'rm key.json'
        }
    }
}
  • Stage 4 ทำการทดสอบในรูปแบบของ Component Test โดยใช้คำสั่ง npm component_test

Deploy

stage('Deploy') {
    steps {
        echo 'Deploy'
    }
}
  • Stage 5 ทำการ Deploy ลง Firebase

Database

  • มีการเชื่อมและใช้ข้อมูลใน Database

End-to-End Test

stage('E2E test') {
    steps {
        echo 'npm e2e_test'
    }
}
  • Stage 6 ทำการทดสอบในรูปแบบของ End-to-End Test โดยใช้คำสั่ง npm e2e_test

Database

  • มีการเชื่อมและใช้ข้อมูลใน Database

Noti

stage('Notification') {
    steps {
        echo 'Everything is OK'
    }
}
  • Stage 7 ทำการสรุปและบันทึกผลของการทำงานทั้งหมดให้กับคนในทีมผ่าน log