We would like to have some improvements to our Android app builds.
Currently we have two build steps in the Jenkins build:
I would like to keep the first step (tox-flake8), but replace the second (maven-checkstyle) with a gradle-checkstyle since we have moved from Maven to Gradle for our build system a while ago, and I would like to drop the pom.xml files. I think this should make the checkstyle build faster, and I guess you should be able to run it on the same box as the old Maven checkstyle step.
The command to run: (all based from the root of our git repo: https://gerrit.wikimedia.org/r/apps/android/wikipedia)
The XML report can be found in ./wikipedia/build/reports/checkstyle/checkstyle.xml
FYI, as you can see, Gradle is invoked using the Gradle wrapper script, ./gradlew, which resides in our repo. So, no need to install Gradle on the build system.
I would like to see a real Android app build using Gradle happening.
We've got a lab system for our Alpha builds, which we can log into, so we can keep the Android SDK up-to-date manually. If you could use this system for Jenkins then you don't need to worry about installing or updating the Android SDK.
Every 30 minutes it checks to see if anything got merged to master. If so, it kicks off a new build. You can see the result of our Alpha build on https://android-builds.wmflabs.org/.
The Android SDK is installed in /srv/adk. You probably need to set ANDROID_HOME to it.
Our Alpha builds currently run via a cronjob (/srv/builds/src/build.py). More env variables are in there that you most likely will need. (Yes, even TERM.) BTW, the scripts are also in https://gerrit.wikimedia.org/r/labs/tools/wikipedia-android-builds.
The user name is android-build. Please contact YuviPanda or other wmflabs if there are access issues. Yuvi set up the current Alpha build on this machine.
Please keep the Alpha setup intact for now. If needed, e.g. due to suspected conflicts/duplicated build efforts, you can comment out the crontab. It's probably best to use a new folder for the working directory that Jenkins would use for the git repo clone.
The command to run:
./gradlew -q clean assembleAlphaDebug
This will produce an apk file that would be great to make available through Jenkins:
- To replace the current alpha build on https://android-builds.wmflabs.org/ please also add a step for builds that get merged to master:
a) copy the apk to /srv/builds/public_html/runs/latest
b) and create a /srv/builds/public_html/runs/latest/meta.json file with similar contents as it currently has.
The alpha app checks this site periodically to see if there is a newer build available. If there is a new version available then it displays a notification on the device. The code is in org.wikipedia.alphaupdater.AlphaUpdateChecker. It checks commit_hash of meta.json. https://android-builds.wmflabs.org/ uses completed_on.
(Just to be clear. We don't want to update the Alpha apk and meta.json for patches that have not been +2'd yet. We only want this for patches that got merged to master.)
(In the future, it would be great to have the tests run on an emulator, but I'll save that for another task.)
Let me know if you have any questions. Thank you!