<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Renato Stanic on Medium]]></title>
        <description><![CDATA[Stories by Renato Stanic on Medium]]></description>
        <link>https://medium.com/@rstanic12?source=rss-e7d4f22e99d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XBgZwwua5s5gdMtw.</url>
            <title>Stories by Renato Stanic on Medium</title>
            <link>https://medium.com/@rstanic12?source=rss-e7d4f22e99d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 22:40:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rstanic12/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Working with YAML in Gitlab CI from Android perspective]]></title>
            <link>https://medium.com/undabot/working-with-yaml-in-gitlab-ci-from-android-perspective-b8cf54b5b911?source=rss-e7d4f22e99d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8cf54b5b911</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[undabot]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Renato Stanic]]></dc:creator>
            <pubDate>Fri, 30 Jun 2017 14:09:19 GMT</pubDate>
            <atom:updated>2018-01-10T16:26:51.360Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SCDaHRC6hET5RYBoTpG2hA.png" /></figure><h4>Using continuous integration in our everyday workflow can help us a lot with faster and iterative development, and having CI do checks every time we change our codebase helps us with dealing with fear of modifying code. Deploying app builds manually takes time and leaves us idle while we could be developing new and exciting features instead. Here at Undabot we are using <a href="https://about.gitlab.com/">GitLab CI</a> for continuous integration. GitLab CI uses a YAML file for job configuration.</h4><p>In this blog post we will go through a sample YAML configuration for Android projects and describe the main YAML building blocks with common Android CI jobs.</p><p><strong>YAML intro<br></strong>The YAML file defines a set of jobs with constraints stating when they should be run. The jobs are defined as top-level elements with a name and always have to contain at least the script clause:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa9bd1f3bf228fec41be028300317c5b/href">https://medium.com/media/fa9bd1f3bf228fec41be028300317c5b/href</a></iframe><p>YAML syntax allows for more complex job definitions than in the above example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/382f08f9048cf0b7d5db2673c8653122/href">https://medium.com/media/382f08f9048cf0b7d5db2673c8653122/href</a></iframe><p>before_script - commands that run before each jobs script<br>after_script - commands that run after each jobs script<br>stages - used to define build stages<br>only - defines the names of branches and tags for which the job will run<br>tags - used to select specific Runners from the list of all Runners that are allowed to run this project.</p><p><strong>Initial setup for Android<br></strong>First step is to create a YAML file called gitlab-ci.yml in root directory of your Android project and add the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9e9d7cb2b9014f117597ae99509c993/href">https://medium.com/media/d9e9d7cb2b9014f117597ae99509c993/href</a></iframe><p>In before_script we execute these two commands:<br>- export ANDROID_HOME=&quot;$HOME/Library/Android/sdk”`- sets Android home environment variable to be available for all other jobs and Gradle tasks<br> - bundle install- we are using <a href="https://github.com/fastlane/fastlane">fastlane</a> for task automation and Bundler to manage Ruby gems so we need to run bundle install to make sure everything is installed correctly.</p><p>In the stages section we define 4 build stages:<br>- build- for build jobs<br>- test- for test jobs that include unit and instrumentation tests<br>- quality_assurance- for jobs that run all of our QA tools<br>- deploy- for deployment jobs</p><p><strong>Build stage<br></strong>This job (build_job) is used to create an APK artifact that can be used to test the app manually or to upload it to the Play Store.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2522140e421dc505b43728258dbf17b3/href">https://medium.com/media/2522140e421dc505b43728258dbf17b3/href</a></iframe><p>build_job:- name of the CI job <br>stage: build- it gets executed in the build stage<br>./gradlew clean assembleRelease- executes Gradle command to create a release APK<br>artifacts:- job section that defines list of files and directories that are attached to a job after completion.<br>paths:- output file paths <br>app/build/outputs- directory path of our APK</p><p><strong>Unit tests</strong><br>This job (unit_tests) runs our unit tests in a test stage. Every time they fail, a report artifact will be created. Each report artifact expires within 4 days of creation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4e51f177d3cc242b4a5eb033b171ae4/href">https://medium.com/media/a4e51f177d3cc242b4a5eb033b171ae4/href</a></iframe><p>./gradlew test- run Gradle command that triggers our unit tests<br>artifacts:<br>name:- defines artifact name by using <a href="https://docs.gitlab.com/ee/ci/variables/">environment variables</a><br>CI_PROJECT_NAME- project name that is currently being built<br>CI_BUILD_REF_NAME- branch or tag name for which project is built<br>when:- defines <a href="https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts-when">when is it created</a> (on_success, on_failure, always) <br>expire_in:- defines <a href="https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts-expire_in">when is it expired</a>, after artifact has expired it gets deleted from CI</p><p><strong>Instrumentation tests</strong><br>This job (instrumentation_tests) runs all of our instrumentation tests in a test stage by starting a windowless emulator without sound and animations followed by a <a href="https://gist.github.com/anonymous/614aafb2d8710865c688684a8657a141">custom bash script</a> that waits for the emulator to start, after which the device is unlocked by sending key event 82. When the emulator is ready we run the Gradle command for instrumentation tests. Once all tests finished running, the emulator is killed with a <a href="https://gist.github.com/anonymous/614aafb2d8710865c688684a8657a141">custom bash script</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3be9bf353139028358173566917afc20/href">https://medium.com/media/3be9bf353139028358173566917afc20/href</a></iframe><p>- emulator — avd testAVD -no-audio -no-window &amp;<br>- ./ci/android-wait-for-emulator.sh<br>Starts the emulator and waits for it to boot.<br>- adb devices <br>Displays list of found devices in GitLab web terminal<br>- adb shell settings put global window_animation_scale 0 &amp;<br>- adb shell settings put global transition_animation_scale 0 &amp;<br>- abd shell settings put global animator_duration_scale 0 &amp;<br>Disables all animations and transitions</p><p><strong>Static analysis</strong><br>This job (static_analysis) runs all of static code analysis in QA stage. This is a tricky area especially if you are working on a project with a lot of legacy code. My suggestion would be to disable all of the rules and start fixing them one at the time. Tools used for static analysis are lint, checkstyle, pmd and findbugs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b85cd66730cab0e8977e7768ee77d6bf/href">https://medium.com/media/b85cd66730cab0e8977e7768ee77d6bf/href</a></iframe><p>- ./gradlew lint<br>- ./gradlew checkstyle<br>- ./gradlew pmd<br>- ./gradlew findbugs<br>Gradle commands that trigger QA tools.<br>- app/build/reports - path to our QA reports</p><p><strong>Deploy stage</strong><br>The final job (deploy_internal) deploys the app to the QA team in deploy stage. You don’t want to deploy every time you commit something so this step is set as manual. Manual jobs are triggered via GitLab web interface by pressing the play button in your pipeline list. If you are using fastlane as your deployment tool, the last job will look like the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21d133880a309fb03efda3572626968b/href">https://medium.com/media/21d133880a309fb03efda3572626968b/href</a></iframe><p>- bundle exec fastlane android deploy_lane- executes fastlane deploy lane that deploys app to the QA team<br>when: manual - defines <a href="https://docs.gitlab.com/ee/ci/yaml/#when">when is a job executed</a></p><p><strong>There’s plenty more <br></strong>Setting up Android continuous integration with GitLab CI is great and supports plenty of cool features a lot more than we showed. Hopefully this short introduction was helpful and is going to motivate you to discover more features on your own.</p><p>Complete gitlab-ci.yml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48a1b840f7a11fcf17370e17a6246424/href">https://medium.com/media/48a1b840f7a11fcf17370e17a6246424/href</a></iframe><p>Thanks to <a href="https://dribbble.com/pixilated">Sinisa Cvahte</a> for the design.</p><p><strong>Thank you for reading. Please comment, like or share it with your friends and we hope to see you soon.</strong></p><p><strong>Would you like to join us? Check out the open positions at our </strong><a href="https://undabot.com/careers/"><strong>Careers page</strong></a><strong>.</strong></p><p><a href="http://www.undabot.com/en/"><strong>Undabot</strong></a><strong> and </strong><a href="http://www.trikoder.net/"><strong>Trikoder</strong></a><strong> are partner organisations. We analyze, strategize, design, code and develop native mobile apps and complex web systems.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8cf54b5b911" width="1" height="1" alt=""><hr><p><a href="https://medium.com/undabot/working-with-yaml-in-gitlab-ci-from-android-perspective-b8cf54b5b911">Working with YAML in Gitlab CI from Android perspective</a> was originally published in <a href="https://medium.com/undabot">Undabot</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>