forked from mebjas/CSRF-Protector-PHP
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
71 lines (66 loc) · 2.78 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
String GITHUB_REPOSITORY = 'CSRF-Protector-PHP'
pipeline {
agent any
options {
ansiColor('xterm')
disableConcurrentBuilds()
timestamps()
}
parameters {
string(name: 'SHARED_LIBRARIES_VERSION', defaultValue: 'master', description: 'The version of the Jenkins shared libraries to use. Can be a branch, tag or Git revision.')
}
triggers {
issueCommentTrigger('.*retest this please.*')
}
stages {
stage('Load Shared Libraries') {
steps {
library "jenkins-global-libraries@${params.SHARED_LIBRARIES_VERSION}"
}
}
stage('Compliance Checks') {
steps {
complianceChecks()
}
}
stage('Unit Tests and Style Checks (PHP 7.4)') {
steps {
withEcr {
sh 'docker compose up --exit-code-from unit_tests_74 --abort-on-container-exit --build unit_tests_74'
}
}
post {
always {
sh 'docker compose down'
xunit tools: [PHPUnit(pattern: 'build/logs/php74/phpunit.xml', deleteOutputFiles: true, failIfNotNew: true, stopProcessingIfError: true)]
clover cloverReportDir: 'build/logs/php74', cloverReportFileName: 'phpunit.coverage.xml',
healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80],
unhealthyTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0],
failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0]
}
}
}
stage('Unit Tests and Style Checks (PHP 8.2)') {
steps {
withEcr {
sh 'docker compose up --exit-code-from unit_tests_82 --abort-on-container-exit --build unit_tests_82'
}
}
post {
always {
sh 'docker compose down'
xunit tools: [PHPUnit(pattern: 'build/logs/php82/phpunit.xml', deleteOutputFiles: true, failIfNotNew: true, stopProcessingIfError: true)]
clover cloverReportDir: 'build/logs/php82', cloverReportFileName: 'phpunit.coverage.xml',
healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80],
unhealthyTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0],
failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0]
}
}
}
stage('Static Application Security Tests') {
steps {
sastTests()
}
}
}
}