forked from Nosto/nosto-magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
80 lines (71 loc) · 2.28 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
#!/usr/bin/env groovy
pipeline {
agent { dockerfile true }
environment {
REPO = credentials('magento')
}
stages {
stage('Prepare environment') {
steps {
checkout scm
}
}
stage('Update Dependencies') {
steps {
sh "composer config repositories.0 composer https://repo.magento.com"
sh "composer config http-basic.repo.magento.com $REPO_USR $REPO_PSW"
sh "composer install --no-progress --no-suggest"
}
}
stage('Code Sniffer') {
steps {
catchError {
sh "./vendor/bin/phpcs --standard=ruleset.xml --report=checkstyle --report-file=chkphpcs.xml || true"
}
}
}
stage('Mess Detection') {
steps {
catchError {
sh "./vendor/bin/phpmd . xml codesize,naming,unusedcode,controversial,design --exclude vendor,var,build,tests --reportfile phpmd.xml || true"
}
}
}
stage('Phan Analysis') {
steps {
sh "composer create-project magento/community-edition magento"
sh "cd magento && composer config minimum-stability dev"
sh "cd magento && composer config prefer-stable true"
script {
try {
sh "cd magento && composer require --update-no-dev nosto/module-nostotagging:dev-${CHANGE_BRANCH}#${env.GIT_COMMIT.substring(0, 7)}"
} catch (MissingPropertyException e) {
sh "cd magento && composer require --update-no-dev nosto/module-nostotagging:dev-${env.GIT_BRANCH}#${env.GIT_COMMIT.substring(0, 7)}"
}
}
sh "cd magento && bin/magento module:enable --all"
sh "cd magento && bin/magento setup:di:compile"
catchError {
sh "./vendor/bin/phan --config-file=phan.php --output-mode=checkstyle --output=chkphan.xml || true"
}
}
}
stage('Package') {
steps {
script {
version = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
sh "composer archive --format=zip --file=${version}"
sh "composer validate-archive -- ${version}.zip"
}
archiveArtifacts "${version}.zip"
}
}
}
post {
always {
checkstyle pattern: 'chk*.xml', unstableTotalAll:'0'
pmd pattern: 'phpmd.xml', unstableTotalAll:'0'
deleteDir()
}
}
}