Tutorial: setting up Continuous integration with Includable

It is now super easy to set up continuous integration for projects running on the Includable platform. In this tutorial we’ll show you how to use Travis CI to build static assets and deploy the result to Includable.

The basics

First make sure you have the latest version of the Includable CLI installed: 
npm i -g includable

Then, you can start creating your first Includable module: inc create. Let’s go for the svelte starter pack. Svelte is a super cool front-end framework that is compiled beforehand, resulting in a super tiny javascript file for deployment. By default, this starter kit will require the developer to compile their assets themselves (happens automatically when running inc run) and checks those into their Git repo.

A cleaner solution would be to automatically create those when a new change is committed, and automatically deploying those assets to the Includable Platform. In order to do that, we’ll use Travis CI, one of the many available continuous integration solutions (some others to check out are Circle CI and Codeship).

Updating Gitignore

First off, we want to make sure that compiled static assets are never checked into version control, since they will be created before deployment by our Travis CI script.

In order to do so, we add the following line to .gitignore:

Creating Travis Config

Every CI solution has their own way of configuring what scripts and tests to run. Travis CI requires you to add a file called .travis.yml to your repo. Let’s add that with the following contents:

You can now create you initial commit, and push your code to a public Github repository in the usual way.

Getting started with Travis CI

The only thing left is to tell Travis CI to build your project. For that, simply sign in to travis-ci.org with your Github account.

You can then flip the switch next to the repository you just created to trigger your first build. What you need to do, though, to make sure the build succeeds, is add your Includable token, otherwise Includable won’t know if you are authorized to update your module or not.

You can get your token by going back to your command line, and running inc login --token . The value you will then get back you can add to your environment variables in the Travis CI settings:

Done!

That should do it, you have now set up a continuous integration flow to automatically build and publish any changes you push to your Github repository automatically to Includable.

If you need any help, feel free to ping me @tschoffelen on Twitter.