Adding Snaps support at Travis CI

At Travis CI, we’re working closely with the snapcraft team to improve the development experience while building, releasing and installing snaps.

Since the snapcraft summit, we’ve been working closely with developers of many programming languages so we can make their snaps available for you to use on Travis CI at build time.

The first of these improvements is already available thanks to @bcardiff and @ana_rosas, you can now build and test against Crystal nightly releases.

On the top of that, as long as you’re using Ubuntu Xenial 16.04, you can now use the snaps addon to install any Snap package at build time.

About snaps

Snapcraft is designed to be a universal app distribution system for Linux, including Ubuntu, Debian, OpenSuse, ArchLinux, Gentoo or Fedora.

While APT works well for installing libraries and headers, snaps focus on ease of installation and updating applications. Snaps bundle all of an apps dependencies and are wrapped in a layer of added security. These strictly confined snaps can be trusted to not break on system upgrades, and unless explicitly allowed, can be trusted to not modify the system or peer into the private data of other applications.

This is an example .travis.yml file to install the AWS CLI snap that then you can use it to test a site:

 dist: xenial
   addons:
     snaps:
       - aws-cli

By default, when you install a snap, we fetch it with the default confinement, strict which means that it’s completely isolated from the rest of the system. To change these values, you can specify the confinement or snap release channel that you’d like.

  dist: xenial

  addons:
    snaps:
    - name: aws-cli
      confinement: classic
      channel: edge

Check out the full docs to install snaps at Travis CI here.

Packaging your own snap

To create the snap package for your application / installer, you can follow the docs at the first snap guide

The snaps team is available to help with questions on their community forum at https://forum.snapcraft.io/

Automatically deploy new versions of your snap package

After you test and build your snap at Travis CI, you can automatically upload it to the Snap Store using the deployment: snaps option

For example, the CMake snap uses this workflow and the following configuration file: cmake-snap/.travis.yml


Let us know how this works for you in the Travis CI Community Forum and happy building!