forked from veelkoov/fuzzrake
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
123 lines (109 loc) · 3.14 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
pipeline {
agent {
label 'fuzzrake'
}
stages {
stage('Trigger branches builds') {
when {
branch 'develop'
}
steps {
script {
sh(
script: '''git branch -a | grep '^ remotes/origin/' | cut -d/ -f3-''',
returnStdout: true,
)
.tokenize("\n")
.each { branch ->
if (!['main', 'beta', 'develop'].contains(branch)) {
try {
build(
job: currentBuild.fullProjectName.replaceFirst(~/\/${env.BRANCH_NAME}$/, "/$branch"),
wait: false,
)
} catch (error) {
echo(error.getMessage())
}
}
}
}
}
}
stage('Merge develop') {
when {
not {
branch 'develop'
}
}
steps {
ansiColor('xterm') {
sh 'git merge --no-edit origin/develop'
}
}
}
stage('Install') {
environment {
GOOGLE_RECAPTCHA_SITE_KEY = credentials('GOOGLE_RECAPTCHA_SITE_KEY')
GOOGLE_RECAPTCHA_SECRET = credentials('GOOGLE_RECAPTCHA_SECRET')
}
steps {
ansiColor('xterm') {
dir('tests/test_data/statuses') {
git(branch: 'main', poll: false, url: env.FUZZRAKE_STATUSES_TEST_DATA_GIT_URI)
}
sh 'rm -f .env.test.local'
sh 'echo "GOOGLE_RECAPTCHA_SITE_KEY=$GOOGLE_RECAPTCHA_SITE_KEY" >> .env.test.local'
sh 'echo "GOOGLE_RECAPTCHA_SECRET=$GOOGLE_RECAPTCHA_SECRET" >> .env.test.local'
sh './toolbox docker-up'
sh './toolbox composer install'
sh 'yarn install'
sh './toolbox yep'
sh './toolbox pu --version'
sh './toolbox console doctrine:schema:create'
}
}
}
stage('QA') {
parallel {
stage('PHPUnit') {
steps {
ansiColor('xterm') {
sh './toolbox pu --log-junit junit-results.xml --coverage-clover clover-results.xml --coverage-html coverage-results]'
}
}
post {
always {
junit 'junit-results.xml'
clover cloverReportDir: '.',
cloverReportFileName: 'clover-results.xml',
failingTarget: [conditionalCoverage: 20, methodCoverage: 20, statementCoverage: 20],
healthyTarget: [conditionalCoverage: 50, methodCoverage: 50, statementCoverage: 50],
unhealthyTarget: [conditionalCoverage: 40, methodCoverage: 40, statementCoverage: 40]
}
}
}
stage('PHP-CS-Fixer') {
steps {
ansiColor('xterm') {
sh './toolbox pcf --dry-run --diff'
}
}
}
stage('PHPStan') {
steps {
ansiColor('xterm') {
sh './toolbox ps -v'
}
}
}
stage('Rector') {
steps {
ansiColor('xterm') {
sh './toolbox rector --dry-run'
}
}
}
}
}
}
}