-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
executable file
·49 lines (49 loc) · 1.16 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
38
39
40
41
42
43
44
45
46
47
48
49
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Composer Install Dev') {
steps {
sh 'composer2 install --no-scripts --ignore-platform-reqs --no-progress --no-suggest'
}
}
stage ('Static code analysis') {
steps {
parallel (
"Check PSR-2": {
sh 'php83 vendor/bin/phpcs --standard="PSR12" -n src/ tests/'
},
"PHPStan": {
sh 'php83 vendor/bin/phpstan analyse src -l 5 -c phpstan.neon'
}
)
}
}
stage('Unit Tests') {
steps {
sh 'php83 vendor/bin/phpunit -c phpunit.xml.dist --testsuite=unit'
}
}
stage('Integration Tests') {
steps {
sh 'php83 vendor/bin/phpunit -c phpunit.xml.dist --testsuite=integration'
}
}
stage('Deploy to production') {
when { branch 'master' }
steps {
script {
def date = new Date()
writeFile(file: 'info.json', text: "{\"release_date\": \"" + date + "\"}")
}
sh 'composer2 install --no-dev --optimize-autoloader --no-scripts --ignore-platform-reqs --no-progress --no-suggest'
sh 'composer2 archive --format=tar --file=artifact'
sh 'ansible-playbook ansible/deploy.yml'
}
}
}
}