-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcodemagic.yaml
More file actions
150 lines (149 loc) · 3.87 KB
/
codemagic.yaml
File metadata and controls
150 lines (149 loc) · 3.87 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
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
# Has a separate flows for develop branch (automatic builds),
# Merge Request (automatic builds) and main branch Release builds (manual builds).
definitions:
artifacts: &androidArtifacts # Section def
- emulator.log
- labencryptedstorage/build/reports
- labencryptedstorage/build/outputs/androidTest-results
- labencryptedstorage/build/outputs/logs
- labencryptedstorage/build/outputs/**/*.aar
- labencryptedstorage/build/outputs/**/mapping.txt
- sample/build/outputs/apk/**/*.apk
debug-emails: &debugEmails
- harri.kirik@lab.mobi
release-emails: &releaseEmails
- harri.kirik@lab.mobi
scripts:
# Local setup
- &stepLocalSetup
name: Set up local properties and permissons
script: |
chmod +x gradlew
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/local.properties"
# Run checkCode
- &stepCheckCode
name: Check code style and formatting
script: ./gradlew checkCode
# Build RELEASE
- &stepBuildRelease
name: Build Android
script: ./gradlew buildAll
# Start emulator
- &stepStartEmulator
name: Launch emulator
script: |
cd $ANDROID_HOME/tools
emulator -avd emulator &
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'
# Stop emulator
- &stepStopEmulator
name: Stop emulator
script: |
cd $ANDROID_HOME/tools
adb emu kill
# Run tests
- &stepRunTests
name: Test Android
script: |
./gradlew connectedAndroidTest
result=$?
adb logcat -d > emulator.log
if [ $result -eq 0 ]
then
echo "Tests executed successfully"
else
echo "Tests failed"
exit 1
fi
# Build PUBLISH
- &stepBuildPublish
name: Publish to Maven Central
script: |
./gradlew buildAndPublishRelease
# Flows
workflows:
release-builds:
name: Release builds for verification (main branch only)
instance_type: linux_x2
environment:
java: 17
scripts:
- name: Check 'main' branch
script: if [ "$FCI_BRANCH" != "main" ]; then exit 1; fi
- *stepLocalSetup
- *stepCheckCode
- *stepStartEmulator
- *stepRunTests
- *stepStopEmulator
- *stepBuildRelease
publishing:
email:
recipients: *releaseEmails
artifacts: *androidArtifacts
publish-builds:
name: Publish to Maven builds (main branch only)
instance_type: linux_x2
environment:
java: 17
groups:
- mavenCentralPublishing
scripts:
- *stepLocalSetup
- *stepCheckCode
- *stepStartEmulator
- *stepRunTests
- *stepStopEmulator
- *stepBuildPublish
publishing:
email:
recipients: *releaseEmails
artifacts: *androidArtifacts
develop-builds:
name: Development builds
instance_type: linux_x2
environment:
java: 17
triggering:
events:
- push
- pull_request
branch_patterns:
- pattern: 'develop'
include: true
source: true
scripts:
- *stepLocalSetup
- *stepCheckCode
- *stepStartEmulator
- *stepRunTests
- *stepStopEmulator
- *stepBuildRelease
artifacts: *androidArtifacts
publishing:
email:
recipients: *debugEmails
merge-requests:
name: Merge requests
instance_type: linux_x2
environment:
java: 17
triggering:
events:
- pull_request
branch_patterns:
- pattern: 'develop'
include: true
source: false
cancel_previous_builds: true
scripts:
- *stepLocalSetup
- *stepCheckCode
- *stepStartEmulator
- *stepRunTests
- *stepStopEmulator
- *stepBuildRelease
publishing:
email:
recipients: *debugEmails
notify:
success: false