-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
81 lines (73 loc) · 2.58 KB
/
.gitlab-ci.yml
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
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml
# Read more about this script on this blog post https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/, by Jason Lenny
# If you are interested in using Android with FastLane for publishing take a look at the Android-Fastlane template.
image: larsselbekk/battlegoose-ci:1.0
stages:
- build
- test
- visualize
# Packages installation before running script
.android_setup_template: &android_setup
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export GITLAB_USER_NAME=GHOST
- chmod +x ./gradlew
- >
yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses || true
sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-${ANDROID_COMPILE_SDK}"
sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools"
sdkmanager --sdk_root=${ANDROID_HOME} "build-tools;${ANDROID_BUILD_TOOLS}"
cache:
paths:
- .gradle/wrapper
- .gradle/caches
# Basic android and gradle stuff
# Check linting
#lint: # Disabled, as we've added ktlint instead
# <<: *android_setup
# interruptible: true
# stage: build
# script:
# - ./gradlew --no-daemon -Pci --console=plain lint -PbuildDir=lint
# Run ktlint - Linting and formatting
ktlint:
<<: *android_setup
interruptible: true
stage: build
script:
- ./gradlew --no-daemon -Pci --console=plain ktlint
# Make Project
assemble:
<<: *android_setup
interruptible: true
stage: build
script:
- ./gradlew --no-daemon assembleDebug
artifacts:
expose_as: APK
paths:
- android/build/outputs/apk/debug/android-debug.apk
# Run all tests, if any fails, interrupt the pipeline(fail it)
unitTests:
<<: *android_setup
interruptible: true
stage: test
script:
- ./gradlew --no-daemon -Pci --console=plain test
- >
awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/",
instructions, " instructions covered"; print 100*covered/instructions, "% covered" }'
core/build/reports/jacoco/test/jacocoTestReport.csv
coverage: "/([0-9]{1,3}.[0-9]*).%.covered/"
artifacts:
when: always
expose_as: "Test results"
paths:
- core/build/reports/jacoco/
- core/build/test-results/
reports:
junit: core/build/test-results/test/**/TEST-*.xml