test: refs #6695 better stages
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-01-31 14:56:42 +01:00
parent 8f0f993a64
commit 940bc7f1ff
1 changed files with 62 additions and 64 deletions

126
Jenkinsfile vendored
View File

@ -66,76 +66,74 @@ pipeline {
sh 'pnpm install --prefer-offline'
}
}
stage('Test') {
stages {
stage('Unit') {
when {
expression { !PROTECTED_BRANCH }
stages {
stage('Unit') {
when {
expression { !PROTECTED_BRANCH }
}
environment {
NODE_ENV = ""
}
steps {
sh 'pnpm run test:unit:ci'
}
post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
environment {
NODE_ENV = ""
}
}
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'
}
}
steps {
sh 'pnpm run test:unit:ci'
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'
}
}
}
}
post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
stage('Run E2E') {
steps {
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
}
}
}
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()
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
post {
always {
cleanDockerE2E()
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
}
}