forked from eclipse-archived/antenna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
78 lines (74 loc) · 2.91 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
/*
* Copyright (c) Bosch Software Innovations GmbH 2019.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*/
/*
* Standard Jenkinsfile to be easily applicable in
* a local Jenkins infrastructure
*/
pipeline {
agent any
parameters {
booleanParam(
name: 'RUN_TESTS',
defaultValue: true,
description: '')
}
stages {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// build antenna
stage('build') {
steps {
withMaven() {
// build antenna
sh """
mvn -Dmaven.repo.local=\$(readlink -f localRepository) \
--batch-mode \
install -DskipTests
"""
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// run tests and try to execute antenna
stage('test') {
when {
environment name: 'RUN_TESTS', value: 'true'
}
steps {
withMaven() {
// run maven tests
sh '''
mvn -Dmaven.repo.local=$(readlink -f localRepository) \
--batch-mode \
test
'''
// test as maven plugin
sh 'MAVEN_OPTS="-Dmaven.repo.local=$(readlink -f ./repository)" .ci-scripts/test-ExampleTestProject-with-maven.sh'
// run SW360 integration tests, if corresponding sqldump is present
sh '''
if [[ -f modules/sw360/src/test/resources/postgres/sw360pgdb.sql ]]; then
.ci-scripts/test-sw360-integration-test.sh
fi
'''
// test as CLI tool
sh '.ci-scripts/test-ExampleTestProject-with-CLI.sh'
// test as gradle plugin
sh 'M2_REPOSITORY="$(readlink -f ./repository)" .ci-scripts/test-ExampleTestProject-with-gradle.sh'
// test the antenna site
sh 'MAVEN_OPTS="-Dmaven.repo.local=$(readlink -f ./repository)" .ci-scripts/test-antenna-documentation-site-tests.sh'
// run static code analysis
sh '''
mvn install -DskipTests pmd:pmd checkstyle:checkstyle-aggregate spotbugs:check -Dmaven.repo.local=$(readlink -f localRepository)
'''
}
}
}
}
}