-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
90 lines (78 loc) · 3.37 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
// This file is a generic Scoutnet Jenkins file. The original is found in the dummy extension
// https://github.com/scoutnet/plugins.typo3.scoutnet_dummy/blob/main/Jenkinsfile
// Jenkinsfile Version: 3.0.3
// changed to suite this non TYPO3 lib
pipeline {
agent any
environment {
TYPO3_PATH_WEB = '/opt/typo3/web'
}
stages {
stage('Test'){
steps {
withCredentials([usernamePassword(credentialsId: 'REPO_AUTH', passwordVariable: 'REPO_AUTH_PASSWORD', usernameVariable: 'REPO_AUTH_USER')]) {
script {
def PHP_VERSIONS = ['8.1', '8.3'] // Only support first and last supported Version to Speed Tests up
def tests = [:]
sh "echo '{\"http-basic\": {\"repo.scoutnet.de\": {\"username\": \"${REPO_AUTH_USER}\", \"password\": \"${REPO_AUTH_PASSWORD}\"}}}' > auth.json"
sh "make init"
tests['cgl Test'] = {
echo "Testing CGL"
sh "make cglTest"
}
for (x in PHP_VERSIONS) {
def PHP_VERSION = x.replace('.','')
tests[PHP_VERSION] = {
echo "Testing PHP Version ${PHP_VERSION}"
sh "make lintTest-php${PHP_VERSION}"
sh "make unitTest-php${PHP_VERSION}"
}
}
parallel tests
sh 'rm -f auth.json'
}
}
}
}
stage('Deploy'){
when {
expression {
env.TAG_NAME ==~ /^[0-9]+[.][0-9]+[.][0-9]+$/
}
}
steps {
withCredentials([string(credentialsId: 'GITHUB_TOKEN', variable: 'GITHUB_TOKEN'), usernamePassword(credentialsId: 'ac854e35-e62e-4aa1-b7ac-2ced736da9e6', passwordVariable: 'TYPO3_TER_PASSWORD', usernameVariable: 'TYPO3_TER_USER')]) {
sh 'docker run --rm -e TYPO3_TER_PASSWORD -e TYPO3_TER_USER -e GITHUB_TOKEN -w /opt/data -v `pwd`:/opt/data -i scoutnet/buildhost:latest make release'
}
}
}
stage('Notify') {
steps {
withCredentials([string(credentialsId: 'CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
script {
def uploads = [:]
uploads["unit"] = {
echo "Uploading Covereage for UnitTests"
sh "codecovcli upload-process --disable-search --plugin none -F unitTests -f '${WORKSPACE}/.Build/coverage-php*-unit.xml'"
}
parallel uploads
}
}
}
}
}
post {
always {
script {
sh 'rm -f auth.json'
sh 'make cleanDocker'
if (currentBuild.currentResult == 'FAILURE') {
color = 'danger'
} else {
color = 'good'
}
slackSend color: color, message: "<${env.JOB_URL}|${env.JOB_NAME}>: Build ${currentBuild.currentResult}"
}
}
}
}