class: center, middle # TravisCI for your next OSS project > Develop in the open w/ an awesome CI: free, fast & well documented. .footnote.small.faded.align-center[ [TravisCI](https://travis-ci.org/) - [as24-custom-events pipeline](https://travis-ci.org/Scout24/as24-custom-events) Dr. Inaki Anduaga - Lead Engineer @ AutoScout24 ] --- class: left ## TravisCI Highlights - **Free** for public github repos. - **dockerized builds**, also language/version-based agents - **Cache** of dependencies between builds for free - **Cronjobs** for regularly repeating build, say every day - [YAML](https://github.com/Scout24/as24-custom-events/blob/master/.travis.yml) file as main configuration. No magic, WYSIWYG. - **bash/script** support within YAML. --- ## CLI power - ruby gem - Provides short commands for a bunch of things. Interactive #### Example: Initialize a new project - Install `travis` cli - (optional login) - Initialize new project --
--- ## Managing Secrets > Public doesn't mean insecure... TravisCI supports encoding secrets: - passwords, access tokens, play app secret, etc ```sh travis encrypt GITHUB_AUTH=FOO --add ``` will be available under the `$GITHUB_AUTH` environment variables during build --
--- ## Secure SSH keys > Github read/write access during build using deploy keys SSH keys can be encrypted and checked in: ```sh ssh-keygen -t rsa -b 4096 -f 'mykey_rsa' -N '' travis encrypt-file ./mykey_rsa ``` --
--- ## Secure SSH keys > Github read/write access during build using deploy keys ### Github integration 1. Add `SSH` key as [github deploy key](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys) 2. Add key to `ssh-agent` [during build](https://github.com/Scout24/as24-custom-events/blob/master/.travis.yml#L17): ```sh chmod 600 travis_ci_rsa eval `ssh-agent -s` ssh-add travis_ci_rsa ``` You can now push commits back to github (or access private repos) --- ## Release providers - Github releases: `travis setup releases` - Alternative due to [bug in body payload](https://github.com/travis-ci/dpl/issues/155): Use [github SDK directly](https://github.com/Scout24/as24-custom-events/blob/master/gh-release.sh) - Easy to publish to npm: `travis setup release npm`
--- ## More complex example: > Fully automatic releases based on github PR labels 1. Manually add [semantic-release label](https://github.com/Scout24/as24-custom-events/pull/23) to PRs (patch/minor/major) 2. After PR merged, Travis will - Run regular build - Check if PR has a `release` label [applied](https://github.com/Scout24/as24-custom-events/blob/master/semver_from_pr_labels.sh#L19) - If label applied: 1. **Bump package version** accordingly 2. Create a **new tagged commit** & push commit to github master branch - [Example](https://travis-ci.org/Scout24/as24-custom-events/builds/435582751#L595) 3. On tagged commits: - Create github release: add changelog since last commit - Create npm release - [Example](https://travis-ci.org/Scout24/as24-custom-events/builds/435583416#L618)