-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
45 lines (42 loc) · 1.53 KB
/
Jenkinsfile
File metadata and controls
45 lines (42 loc) · 1.53 KB
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
def parallelStages = [:]
def firstStage = [:]
def driveCommand = "flutter drive --driver=test_driver/integration_test.dart --target=integration_test/main_test.dart"
def complementCommand = "--no-pub --use-application-binary=build/app/outputs/flutter-apk/app-debug.apk"
pipeline {
agent any
stages{
stage('Identifying connected devices'){
steps{
script {
sh('adb start-server')
def devices = sh (
script: "adb devices -l | awk \'NR>1 {print \$1}\'",
returnStdout: true
).trim().split('\n')
def isFirstIteration = true;
for (String device : devices){
def deviceCopy = new String(device)
if(isFirstIteration){
firstStage["${deviceCopy}"] = {
stage("Building APK and running Flutter Driver on device ${deviceCopy}"){
sh 'pwd'
sh "${driveCommand} -d ${deviceCopy}"
}
}
isFirstIteration = false;
} else {
parallelStages["${deviceCopy}"] = {
stage("Running flutter drive on Device ID: ${deviceCopy}"){
sh 'pwd'
sh "${driveCommand} ${complementCommand} -d ${deviceCopy}"
}
}
}
}
firstStage.values()[0].call()
parallel(parallelStages)
}
}
}
}
}