Generate stuff report before tests

pull/12/head
Nicolas Arenas 2024-10-23 08:17:28 +02:00
parent e675af2b24
commit e6024eb110
2 changed files with 9 additions and 15 deletions

22
Jenkinsfile vendored
View File

@ -46,11 +46,11 @@ pipeline {
steps { steps {
// Install dependencies // Install dependencies
sh """ sh """
rm -rf ./report
docker compose exec php composer install docker compose exec php composer install
docker compose exec php php bin/console lexik:jwt:generate-keypair --overwrite docker compose exec php php bin/console lexik:jwt:generate-keypair --overwrite
docker compose exec php php bin/console doctrine:migrations:migrate --no-interaction docker compose exec php php bin/console doctrine:migrations:migrate --no-interaction
docker compose exec php php bin/console doctrine:fixtures:load --no-interaction docker compose exec php php bin/console doctrine:fixtures:load --no-interaction
docker compose exec php mkdir -p /report
""" """
} }
} }
@ -59,19 +59,9 @@ pipeline {
// Run tests // Run tests
sh """ sh """
docker compose exec php bin/phpunit --log-junit /report/phpunit.xml docker compose exec php bin/phpunit --log-junit /report/phpunit.xml
docker compose cp php:/report/phpunit.xml ./phpunit.xml
""" """
} }
} }
stage ("Delete Image") {
steps {
script {
sh "docker compose -f ${DOCKER_COMPOSE_FILE} down"
sh "docker rmi ${DOCKER_IDENTITY}"
sh "docker rmi ${DOCKER_IDENTITY_NGINX}"
}
}
}
stage ("Publish Image") { stage ("Publish Image") {
steps { steps {
script { script {
@ -86,14 +76,16 @@ pipeline {
} }
post { post {
always { always {
// Publicar los resultados de las pruebas de PHPUnit // Publish JUnit test results
xunit ( xunit (
thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ], thresholds: [ skipped(failureThreshold: '0') , failed(failureThreshold: '0') ],
tools: [ PHPUnit(pattern: 'phpunit.xml') ] tools: [ PHPUnit(pattern: 'phpunit.xml') ]
) )
// Remove containers // Remove containers
sh 'docker compose -f ${DOCKER_COMPOSE_FILE} down' sh "docker compose -f ${DOCKER_COMPOSE_FILE} down"
sh 'docker compose -f ${DOCKER_COMPOSE_FILE} rm -f' sh "docker compose -f ${DOCKER_COMPOSE_FILE} rm -f"
sh "docker rmi ${DOCKER_IDENTITY}"
sh "docker rmi ${DOCKER_IDENTITY_NGINX}"
} }
} }
} }

View File

@ -43,6 +43,8 @@ services:
networks: networks:
- ogcore-network - ogcore-network
image: ogcore-php:static image: ogcore-php:static
volumes:
- ./report:/report/
volumes: volumes:
database_data: database_data: