naiyu naiyu - 3 months ago 190
Android Question

Configuring gitlab ci for Android project

I have a '.gitlab-ci.yml' file in my project root:

job_build_debug_apk:
script:
- ./gradlew assembleRelease
stage: deploy
tags:
- android
allow_failure: true


while I push to the master, it will build and is succesed, but I can find any apk file in my project.

This is my log:

running with gitlab-ci-multi-runner 1.4.2 (bcc1794)
Using Shell executor...
Running on userMacBook-Pro.local...
Fetching changes...
Removing .gradle/
Removing app/build/
Removing build/
HEAD is now at 3ae32fc back back
From http://gitlab.xxx.com/naiyu/AdminYDT
3ae32fc..5312eaa master -> origin/master
Checking out 5312eaaf as master...
$ ./gradlew assembleRelease
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:app:prepareComAndroidSupportAppcompatV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComAndroidSupportSupportVectorDrawable2340Library
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:mergeReleaseShaders
:app:compileReleaseShaders
:app:generateReleaseAssets
:app:mergeReleaseAssets
:app:generateReleaseResValues
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseManifest
:app:processReleaseResources
:app:generateReleaseSources
:app:incrementalReleaseJavaCompilationSafeguard
:app:compileReleaseJavaWithJavac
:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithDexForRelease
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:app:mergeReleaseJniLibFolders
:app:transformNative_libsWithMergeJniLibsForRelease
:app:processReleaseJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForRelease
:app:packageRelease
:app:assembleRelease

BUILD SUCCESSFUL

Total time: 32.012 secs
Build succeeded


My runner executor is
Shell
on my Mac OS.

Is there any wrong with my path, or is there has any blog to show this.

Answer

The Gitlab CI works like that: you push changes to the server and your local runner make a clone (or a pull) of your latest changes.

The sources will be downloaded in a subfolder of the runner, not in your project. This means that the apk will be in one of these subfolders as well.