-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
179 lines (166 loc) · 6.12 KB
/
build.gradle
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import org.arquillian.spacelift.gradle.android.*
import org.arquillian.spacelift.gradle.arquillian.*
import org.arquillian.spacelift.gradle.maven.*
import org.arquillian.spacelift.gradle.utils.*
import org.arquillian.spacelift.Spacelift
import org.arquillian.spacelift.task.os.CommandTool
import org.arquillian.spacelift.process.CommandBuilder
// own tasks
import org.arquillian.safari.net.*
import java.io.File
defaultTasks 'test'
apply plugin: 'spacelift'
// additional parameters you can pass from command line via -P{{name}}={{value}}
ext {
androidTargets = [[name: 'Google Inc.:Google APIs (x86 System Image):19', abi: 'default/x86'],
[name: 'Google Inc.:Google APIs:21', abi: 'google_apis/x86']]
defaultBrowsers = ['firefox', 'chrome']
}
spacelift {
// this is where Spacelift will perform tests
workspace = new File(project.rootDir, 'ws')
// this is where Spacelift will cache installations
installationsDir = new File(project.rootDir, 'ws/installations')
tools {
// create Spacelift task for calling Java
java {
command ([
linux: "java",
windows: "java.exe",
mac: "java",
solaris: "java"
])
}
// create Spacelift task for calling Maven
mvn {
command {
def m2 = System.getenv("M2")
def m2_home = System.getenv("M2_HOME")
def mvnPath = null
if (m2 != null && !m2.isEmpty() && (new File(m2, 'mvn')).exists()) {
mvnPath = new File(new File(m2), 'mvn').getCanonicalPath()
} else if (m2_home != null && !m2_home.isEmpty() && (new File(m2_home, 'mvn')).exists()) {
mvnPath = new File(new File(m2_home), 'mvn').getCanonicalPath()
} else {
mvnPath = "mvn"
}
if(EnvironmentUtils.runsOnWindows()) {
mvnPath += '.bat'
}
return new CommandBuilder(mvnPath)
}
}
}
// various execution profiles
// you can specify a profile by -P{{profileName}}
profiles {
// this profile is triggered by default
"default" {
enabledInstallations '*'
tests '*'
}
androidTests {
enabledInstallations 'androidSdk'
tests 'droidiumScenario'
}
browserTests {
tests 'browsersScenario'
}
restTests {
tests 'restScenario'
}
dockerTests {
tests 'dockerScenario'
}
}
// these installation will be installed prior tests are executed
installations {
// install Android SDK
androidSdk(from:AndroidSdkInstallation) {
product 'android'
version '24.0.2'
androidTargets project.androidTargets
createAvds false
postActions {
// update arquillian.xml files with Android homes in all installations and integration test directory
Spacelift.task([
androidHome: "${home}",
androidSdkHome: "${project.spacelift.workspace}"
], ArquillianXmlUpdater)
.dir(project.rootDir).extension('droidium-platform').execute().await()
}
}
}
// test definitions
tests {
droidiumScenario {
// this will be executed for each android target defined in ext {}
dataProvider {
project.androidTargets
}
execute { target ->
// execute example tests where Droidium is used
Spacelift.task(MavenExecutor)
.pom("${project.rootDir}/arquillian-droidium-scenario/pom.xml")
.goals('clean','test')
.androidTarget(target.name)
.surefireSuffix("android-${target.name[-2..-1]}")
.property("arq.group.containers.container.android.configuration.avdName=${target.name.replaceAll('[\\W]|_', '')}")
.execute().await()
}
}
browsersScenario {
// try to figure out what is the real IP of this machine
// also shows that you can define tasks locally in buildSrc
def ip = Spacelift.task(GuessRealIPTask).execute().await()
println "Trying to run test with ${ip}"
dataProvider {
// if not provided from command line (-Pbrowsers), this is has defaultBrowsers value
project.browsers
}
execute { browser ->
Spacelift.task(MavenExecutor)
.pom("${project.rootDir}/arquillian-browsers-scenario/pom.xml")
.goals('clean', 'test')
.property("jboss.bind.address=${ip}")
.surefireSuffix(browser)
.profiles('arq-jbossas-managed', "webdriver-${browser}")
.execute().await()
}
}
restScenario {
execute { browser ->
Spacelift.task(MavenExecutor)
.pom("${project.rootDir}/arquillian-rest-scenario/pom.xml")
.goals('clean', 'test')
.profiles('arq-jbossas-managed')
.execute().await()
}
}
dockerScenario {
execute { browser ->
Spacelift.task(MavenExecutor)
.pom("${project.rootDir}/arquillian-docker-scenario/pom.xml")
.goals('clean', 'test')
.execute().await()
}
}
}
}
// build dependencies
buildscript {
repositories {
mavenCentral()
// you need this only if you plan to use SNAPSHOT version of this plugin
maven {
name 'jboss-staging-repository-group'
url 'https://repository.jboss.org/nexus/content/groups/staging'
}
}
dependencies {
classpath 'org.arquillian.spacelift.gradle:arquillian-spacelift-gradle:1.0.0-alpha-7'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.2'
}