STK
STK

Reputation: 86

Setup gitlab cicd for mobile automation using appium?

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 :)

Upvotes: 4

Views: 8254

Answers (3)

Ankit
Ankit

Reputation: 1

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

Upvotes: 0

BelovedFool
BelovedFool

Reputation: 445

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?

Upvotes: 1

Wasiq Bhamla
Wasiq Bhamla

Reputation: 959

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.

Upvotes: 0

Related Questions