Sunday, August 21, 2016

Google App Engine Continuous Integration with GitHub and CircleCI

In this blog post, I will share how to implement continuous integration with your GitHub repository for your Google App Engine application.

First of all, what is Continuous Integration (CI)? In a normal process of a development cycle, developers will go through several steps, especially for GitHub as stated in GitHub Flow:

Without CI yet:

That sounds reasonable, right? However, it can be more perfect. With CI, developers can define test cases and run it automatically before deploying to production server. Also, CI also helps streamline the whole deployment process by triggering it automatically after code merge, instead of deploying by humans.

With CI, you can do more as follows:

Continuous Integration service providers There are several service providers of Continuous Integration, such as CircleCI, Travis CI, etc. Some of them offers free package for open source projects. If you have an open source projects, it is worth a try.

In this blog post, the main focus is on CI with CircleCI.

CI for Google App Engine I have created this GitHub repository as an working example to demonstrate how to setup CI with Google App Engine from a GitHub repo. The detailed steps are listed in the GitHub repo. Fork it to have a try!

Here are some points to note:
  • You will need to create an CircleCI account by granting access for it to retrieve all of your repos. You may wish to create a separate GitHub account to manage your repos under different organizations.
  • The example only compiles a
    webapp2
    application in GAE. If your application needs more packages installed for a test, you will need to edit the content of file circle.yml (
    dependencies
    >
    pre
    )

CircleCI Badge for your GitHub repo You can add this in the README.md of your GitHub repo:
![](https://circleci.com/gh/<owner>/<repo>.png?&style=shield&circle-token=<YOUR TOKEN HERE>)

Find more about the badges in the CircleCI documentation.
Summary After reading this blog post, you should understand the basic idea of how to setup continuous integration for your GAE application with CircleCI and your GitHub repo.

The demo repo is a very simple application without any functionality. In reality, you may need to take care of your application by defining more complex test cases to ensure it works.