Skip to content

Travis CI

Timothy Langer edited this page May 14, 2018 · 1 revision

Travis CI

Ocquarium uses Travis CI, and this page attempts to explain what the code does and how it works.

Firstly, the Travis configuration file is stored here. Let's examine it more closely.
The first interesting bit is this:

...
if: tag IS blank
...

This means that if the commit is tagged, a build will not run. This allows you to compile a release build manually instead. This uses Travis' conditional syntax, documented here.

Next interesting bit is as follows:

before_install:
- openssl aes-256-cbc -k ${encryption_password} -in ocquarium_keystore.jks.enc -out ocquarium_keystore.jks -d
...

This allows the build to be signed with the release keys but without uploading the .jks file unencrypted to the repository. Instead, I trust Travis' environment variables feature that allows me to supply a password to decrypt the file in the repository.

The following commands set the required permissions on the Bash scripts that deploy Ocquarium to Telegram.

...
- chmod a+x ./scripts/deploy-*.sh
- chmod a+x ./scripts/changelog.sh
...

This is followed by the line...

before_script:
- bash scripts/changelog.sh > changelog.txt

...which allows us, if we wanted to, to include the changelog as a feature within the app.

And these lines below apparently speed up the build process by caching certain files.

before_cache:
- rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
  directories:
  - "$HOME/.gradle/caches/"
  - "$HOME/.gradle/wrapper/"
  - "$HOME/.android/build-cache"

And this line within the deploy section means that only build on the master branch will be published to the Telegram channel. (We don't want people's pull request builds appearing in the alpha channel until merged)

deploy:
- /* code */
  on:
    branch: master
...

And that's it. I hope this is useful sometime soon, future me!