test: refs #6695 back and front in parallel
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-31 14:50:03 +01:00
parent 930da78f6c
commit 900b76a4db
1 changed files with 46 additions and 53 deletions

99
Jenkinsfile vendored
View File

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