2022-06-08 17:35:09 +00:00
|
|
|
pipeline {
|
2022-06-09 07:45:33 +00:00
|
|
|
agent none
|
|
|
|
stages {
|
2022-06-09 08:20:46 +00:00
|
|
|
stage('Fetch dependencies') {
|
|
|
|
agent {
|
|
|
|
docker 'circleci/node:9.3-stretch-browsers'
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
sh 'yarn'
|
|
|
|
stash includes: 'node_modules/', name: 'node_modules'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:20:46 +00:00
|
|
|
stage('Lint') {
|
|
|
|
agent {
|
|
|
|
docker 'circleci/node:9.3-stretch-browsers'
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
unstash 'node_modules'
|
|
|
|
sh 'yarn lint'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:20:46 +00:00
|
|
|
stage('Unit Test') {
|
|
|
|
agent {
|
|
|
|
docker 'circleci/node:9.3-stretch-browsers'
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
unstash 'node_modules'
|
|
|
|
sh 'yarn test:ci'
|
|
|
|
junit 'reports/**/*.xml'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:20:46 +00:00
|
|
|
stage('E2E Test') {
|
|
|
|
agent {
|
|
|
|
docker 'circleci/node:9.3-stretch-browsers'
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
unstash 'node_modules'
|
|
|
|
sh 'mkdir -p reports'
|
|
|
|
sh 'yarn e2e:pre-ci'
|
|
|
|
sh 'yarn e2e:ci'
|
|
|
|
sh 'yarn e2e:post-ci'
|
|
|
|
junit 'reports/**/*.xml'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:20:46 +00:00
|
|
|
stage('Compile') {
|
2022-06-09 07:45:33 +00:00
|
|
|
agent {
|
2022-06-09 08:20:46 +00:00
|
|
|
docker 'circleci/node:9.3-stretch-browsers'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
unstash 'node_modules'
|
|
|
|
sh 'yarn build:prod'
|
|
|
|
stash includes: 'dist/', name: 'dist'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
2022-06-08 17:35:09 +00:00
|
|
|
}
|
2022-06-09 08:20:46 +00:00
|
|
|
stage('Build and Push Docker Image') {
|
|
|
|
agent any
|
|
|
|
environment {
|
|
|
|
DOCKER_PUSH = credentials('docker_push')
|
2022-06-09 08:06:50 +00:00
|
|
|
}
|
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
unstash 'dist'
|
|
|
|
sh 'docker build -t $DOCKER_PUSH_URL/frontend .'
|
|
|
|
sh 'docker login -u $DOCKER_PUSH_USR -p $DOCKER_PUSH_PSW $DOCKER_PUSH_URL'
|
|
|
|
sh 'docker push $DOCKER_PUSH_URL/frontend'
|
2022-06-09 08:06:50 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|