47 lines
1.6 KiB
Groovy
47 lines
1.6 KiB
Groovy
pipeline {
|
|
agent {
|
|
node {
|
|
label 'jenkins-slave'
|
|
}
|
|
}
|
|
|
|
stages {
|
|
stage('Build Environmen') {
|
|
steps {
|
|
//Build environment
|
|
sh 'docker compose -f docker-compose-ci.yaml up --build -d'
|
|
}
|
|
}
|
|
stage('Install dependencies') {
|
|
steps {
|
|
// Install dependencies
|
|
sh 'docker exec ogcore-php composer install'
|
|
sh 'docker exec ogcore-php php bin/console lexik:jwt:generate-keypair --overwrite'
|
|
sh 'docker exec ogcore-php php bin/console doctrine:migrations:migrate --no-interaction'
|
|
sh 'docker exec ogcore-php php bin/console doctrine:fixtures:load --no-interaction'
|
|
// Create report directory
|
|
sh 'docker exec ogcore-php mkdir -p /report'
|
|
}
|
|
}
|
|
stage('Tests') {
|
|
steps {
|
|
// Run tests
|
|
sh 'docker compose exec php bin/phpunit --log-junit /report/phpunit.xml'
|
|
sh 'docker cp ogcore-php:/report/phpunit.xml .'
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
// Publish JUnit test results
|
|
xunit (
|
|
thresholds: [ skipped(failureThreshold: '0') , failed(failureThreshold: '0') ],
|
|
tools: [ PHPUnit(pattern: 'phpunit.xml') ]
|
|
)
|
|
// Remove containers
|
|
sh 'docker compose -f docker-compose-ci.yaml down'
|
|
sh 'docker compose -f docker-compose-ci.yaml rm -f'
|
|
}
|
|
}
|
|
}
|