4

Does anyone worked on setting up Gitlab CICD for mobile automation using appium tool?

I would like to know how to setup the emulator/device for automation in gitlab, also, How to setup the appium server in gitlab.

Your inputs are highly appreciated :)

STK
  • 86
  • 1
  • 4
  • Currently I'm also stuck at the same point, although I'm using CircleCI. You can try with cloud solution like BrowserStack, SauceLabs, etc if you want to avoid hassle to setup emulator in CI/CD. – Wasiq Bhamla Nov 08 '18 at 15:14
  • Thanks Wasiq for your response. Is there any open source service available for android emulators? – STK Nov 21 '18 at 06:08

3 Answers3

1

I found this related link about gitlab-ci and android projects: https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/

However, appium doesn't seem to be used in this example link but I believe it can still be useful if you adapt things a little.

Basically, here is the yml file you need use:

image: openjdk:8-jdk

variables:
  ANDROID_COMPILE_SDK: "28"
  ANDROID_BUILD_TOOLS: "28.0.2"
  ANDROID_SDK_TOOLS:   "4333796"

before_script:
  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
  - unzip -d android-sdk-linux android-sdk.zip
  - echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
  - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
  - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
  - export ANDROID_HOME=$PWD/android-sdk-linux
  - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
  - chmod +x ./gradlew
  # temporarily disable checking for EPIPE error and use yes to accept all licenses
  - set +o pipefail
  - yes | android-sdk-linux/tools/bin/sdkmanager --licenses
  - set -o pipefail

stages:
  - build
  - test

lintDebug:
  stage: build
  script:
    - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint

assembleDebug:
  stage: build
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/

debugTests:
  stage: test
  script:
    - ./gradlew -Pci --console=plain :app:testDebug

I also found this related StackOverflow answer that I found really useful: how to set up a Appium UI test maven project to work with Gitlab CI to test Android App?

BelovedFool
  • 435
  • 6
  • 17
0

I found a repository on GitHub which runs Appium tests in Microsoft Azure DevOps CI environment. Check out the repo here.

Check out how it's CI build was setup and you should be good to go on Azure DevOps instead of GitLab.

Wasiq Bhamla
  • 949
  • 1
  • 7
  • 12
0

I have setup a build pipeline in Gitlab using fast lane for automated building of apk and ipa and uploading them to play store and App Store respectively using fast lane.

You can extend the same to add tests run on Appium

This is a good starting point for learning how to setup a CICD pipeline for a flutter app. https://appditto.com/blog/automate-your-flutter-workflow

Ankit
  • 1
  • 2