Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
181 lines (153 sloc) 3.31 KB
image: registry.gitlab.com/hardysim/android-ci:latest
########## Global settings ##########
cache:
paths:
- .gradle
- .android/build-cache/
stages:
- build base library
- build modules
- demo app build
- test
- staging
- release
before_script:
- export GRADLE_USER_HOME=.gradle
- export ANDROID_SDK_HOME=$CI_PROJECT_DIR
- mkdir .gradle && echo "org.gradle.jvmargs=-Xmx4096m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8" > .gradle/gradle.properties
- chmod +x ./gradlew
########## Job templates ##########
.debugBuild: &debugBuild
tags:
- docker
script:
- >
./gradlew
${MODULE_NAME}:assembleDebug
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- "*/build"
expire_in: 2 hours
except:
- tags
.releaseBuild: &releaseBuild
tags:
- docker
script:
- >
./gradlew
${MODULE_NAME}:assembleRelease
${MODULE_NAME}:androidSourcesJar
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- "*/build"
expire_in: 2 hours
only:
- /^.*-RELEASE$/
.instrumentationTest: &instrumentationTest
stage: test
tags:
- android
before_script:
- echo UI teszt
script:
- ./gradlew ${MODULE_NAME}:connectedDebugAndroidTest
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- "*/build"
expire_in: 2 hours
except:
- tags
.stageMavenCentral: &stageMavenCentral
stage: staging
tags:
- docker
before_script:
- echo $GPG_KEY_CONTENTS | base64 -d > /secret.gpg
- ls -al /
script:
- ./gradlew ${MODULE_NAME}:publishReleasePublicationToSonatypeRepository
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- "*/build"
expire_in: 2 hours
only:
- /^.*-RELEASE$/
.releaseMavenCentral: &releaseMavenCentral
stage: release
tags:
- docker
script:
- ./gradlew closeAndReleaseRepository
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- "*/build"
expire_in: 2 hours
only:
- /^.*-RELEASE$/
########## Concrete jobs ##########
### Base library build ###
krate debug build:
<<: *debugBuild
stage: build base library
variables:
MODULE_NAME: krate
krate release build:
<<: *releaseBuild
stage: build base library
variables:
MODULE_NAME: krate
### Module library builds ###
krate-gson debug build:
<<: *debugBuild
stage: build modules
variables:
MODULE_NAME: krate-gson
krate-gson release build:
<<: *releaseBuild
stage: build modules
variables:
MODULE_NAME: krate-gson
### Demo app build ###
app debug build:
<<: *debugBuild
stage: demo app build
variables:
MODULE_NAME: app
dependencies:
- krate debug build
- krate-gson debug build
### Tests ###
krate instrumentation test:
<<: *instrumentationTest
variables:
MODULE_NAME: krate
dependencies:
- krate debug build
krate-gson instrumentation test:
<<: *instrumentationTest
variables:
MODULE_NAME: krate-gson
dependencies:
- krate-gson debug build
### Staging ###
krate stage to mavencentral:
<<: *stageMavenCentral
variables:
MODULE_NAME: krate
dependencies:
- krate release build
krate-gson stage to mavencentral:
<<: *stageMavenCentral
variables:
MODULE_NAME: krate-gson
dependencies:
- krate-gson release build
### Release ###
release all to mavencentral:
<<: *releaseMavenCentral
You can’t perform that action at this time.