-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
37 lines (35 loc) · 1.19 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pipeline {
agent any
environment {
// Each Jenkins build should be a unique project name for docker compose
// to make sure each build runs the test in an isolated environment.
projectName = "dp_${BUILD_NUMBER}"
}
stages {
stage('Build') {
steps {
sh 'composer install'
sh 'vendor/bin/phpstan analyse'
sh 'vendor/bin/php-cs-fixer check --diff'
sh 'vendor/bin/phpcs --standard=PSR12 app'
}
}
stage('Test') {
steps {
script {
sh """
docker network create global_network || true
docker-compose -p ${projectName} -f test-env/docker-compose.yml build
docker-compose -p ${projectName} -f test-env/docker-compose.yml run --rm test-app
"""
}
}
post {
always {
// Clean up docker resources used above
sh "docker-compose -p ${projectName} -f test-env/docker-compose.yml down -v --rmi local || true"
}
}
}
}
}