test: refs #6695 better stages
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-31 14:52:11 +01:00
parent 900b76a4db
commit 8f0f993a64
1 changed files with 66 additions and 62 deletions

128
Jenkinsfile vendored
View File

@ -66,74 +66,78 @@ pipeline {
sh 'pnpm install --prefer-offline' sh 'pnpm install --prefer-offline'
} }
} }
stage('Test: Unit') { stage('Test') {
when {
expression { !PROTECTED_BRANCH }
}
environment {
NODE_ENV = ""
}
steps {
sh 'pnpm run test:unit:ci'
}
post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
}
}
stage('E2E') {
when {
expression { !PROTECTED_BRANCH }
}
environment {
CREDENTIALS = credentials('docker-registry')
}
stages { stages {
stage('Setup') { stage('Unit') {
when {
expression { !PROTECTED_BRANCH }
}
environment {
NODE_ENV = ""
}
steps { steps {
script { sh 'pnpm run test:unit:ci'
def packageJson = readJSON file: 'package.json' }
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
}
}
stage('E2E') {
when {
expression { !PROTECTED_BRANCH }
}
environment {
CREDENTIALS = credentials('docker-registry')
}
stages {
stage('Setup') {
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
cleanDockerE2E()
}
sh 'rm -rf salix'
sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git'
}
}
stage('Up') {
parallel {
stage('Database & Backend') {
steps {
sh 'cd salix && pnpm i --prefer-offline @verdnatura/myt && npx myt run -t -d'
sh 'docker build -f ./salix/back/Dockerfile -t back ./salix'
sh 'docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back'
}
}
stage('Frontend') {
steps {
sh 'docker-compose -f docker-compose.e2e.yml up -d --build front'
}
}
}
}
stage('Run E2E') {
steps {
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
}
}
}
post {
always {
cleanDockerE2E() cleanDockerE2E()
} junit(
sh 'rm -rf salix' testResults: 'junitresults.xml',
sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git' allowEmptyResults: true
} )
}
stage('Up') {
parallel {
stage('Database & Backend') {
steps {
sh 'cd salix && pnpm i --prefer-offline @verdnatura/myt && npx myt run -t -d'
sh 'docker build -f ./salix/back/Dockerfile -t back ./salix'
sh 'docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back'
}
}
stage('Frontend') {
steps {
sh 'docker-compose -f docker-compose.e2e.yml up -d --build front'
}
} }
} }
} }
stage('Run E2E') {
steps {
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
}
}
}
post {
always {
cleanDockerE2E()
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
} }
} }
stage('Build') { stage('Build') {