-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
95 lines (87 loc) · 2.59 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
91
92
93
94
95
pipeline {
agent any
environment {
FLUTTER_HOME = "/usr/local/flutter"
ANDROID_HOME = "/usr/local/android-sdk"
PATH = "${env.PATH}:${env.FLUTTER_HOME}/bin:${env.ANDROID_HOME}/platform-tools"
}
stages {
stage('Prepare Environment') {
steps {
script {
sh "echo 'PATH is $PATH'"
sh "echo 'Flutter path is $FLUTTER_HOME'"
sh "${FLUTTER_HOME}/bin/flutter --version"
sh "echo 'Android SDK path is $ANDROID_HOME'"
sh "ls -la ${ANDROID_HOME}"
sh "${FLUTTER_HOME}/bin/flutter doctor"
}
}
}
stage('Build Android') {
steps {
script {
sh '''
echo 'Exporting ANDROID_HOME'
export ANDROID_HOME=/usr/local/android-sdk
echo 'Checking Android SDK location'
ls -la $ANDROID_HOME
echo 'Cleaning project...'
flutter clean
echo 'Getting dependencies...'
flutter pub get
echo 'Building APK...'
flutter build apk --debug -v
'''
}
}
}
stage('Test') {
steps {
script {
sh '''
echo 'Running tests...'
flutter test
'''
}
}
}
stage('Package Android') {
steps {
script {
sh '''
echo 'Building release APK...'
flutter build apk --release -v
'''
}
}
}
stage('Build iOS') {
steps {
script {
sh '''
echo 'Building iOS...'
flutter build ios --debug --no-codesign -v
'''
}
}
}
stage('Package iOS') {
steps {
script {
sh '''
echo 'Packaging iOS app...'
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Debug -destination generic/platform=iOS build
'''
}
}
}
}
post {
always {
// Clean up after the pipeline runs
sh 'flutter clean'
}
}
}
//testing