PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 9, 2022

[FIXED] How can I host an Android APK file for every pull-request, so QA can test them before merging?

 October 09, 2022     android, continuous-integration, github     No comments   

Issue

In order to improve our QA workflow, we want to automatically build an APK file for each pull-request on Github so we can test it BEFORE the branch is merged. We already figured out how to build the file, but we are now wondering how to integrate this in our workflow.

It seems like most available Beta programs (e.g. Crashlytics Beta, Google Play) mostly focus on creating one beta version shortly before the release, but don't allow hosting multiple APKs in parallel.

Here's an example for our ideal workflow:

  1. Developer finishes coding and creates a pull-request
  2. Tests run
  3. If tests are successful, an APK is built automatically and uploaded somewhere (that's the part we're trying to figure out)
  4. QA takes a look at the pull-request and should be able to easily download the correct APK on their testing device
  5. If there are no issues during QA, the pull-request is merged
  6. The APK file is automatically deleted

We specifically don't want to test the APK after the pull-request has been merged, but instead test before so less bugs pop up in our develop branch.


Solution

Actually Crashlytics allow to have several versions of APK. Ech version can have each own Version string and of course release notes, to help QA to find correct APK.

Point 3 from question can be described in that way: CI configured to upload build to Crashlytics. It can be achieved by gradle task:

gradle assembleRelease crashlyticsUploadDistributionRelease

It is really useful to have special build type (pullrequest) for this case. You can specify special distribution rules via distribution groups, notifications about builds and release notes.

build.gradle:

//example function for change log 
def getLastGitCommitMessage() {
  try {
    "git log -1 --pretty=%B".execute().text.trim()
  } catch (e) {
    'Undefined message.'
  }
}

android {
  buildTypes {
    ...
    pullrequest { 
      //invitation
      ext.betaDistributionGroupAliases = "QA, devs"
      // notification
      ext.betaDistributionNotifications = true
      // last commit message as release notes
      ext.betaDistributionReleaseNotes = getLastGitCommitMessage()
    }
  }
}

In this case build and upload command will be like that:

gradle assemblePullrequest crashlyticsUploadDistributionPullrequest


Answered By - solikhver
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing