Skip to content

Instantly share code, notes, and snippets.

@ajchemist
Forked from MariadeAnton/hi-satellite.md
Created October 13, 2018 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajchemist/3fe35d2bcd5366a8db824844af7f31a2 to your computer and use it in GitHub Desktop.
Save ajchemist/3fe35d2bcd5366a8db824844af7f31a2 to your computer and use it in GitHub Desktop.
Travis CI Demo Examples - GitHub Satellite 2017

Travis CI - GitHub Satellite 2017

Travis-CI-logo

Menu

Why?

image

Travis Build Status Badge

Travis PR checks

Getting up and running

Best Practices

  • Configure your build to match your production environment. Set up the language you use, and the services, databases and tools that you normally use.

  • Set up Notifications πŸ”” β†’ Fix broken builds as soon as possible. Ensure that you're always developing on a known stable branch.

  • Automate deployment ✨

  • Setting up a deployment pipeline πŸš€ Check out Build Stages

Some workflows tips and tricks!

Fork, activate and start building! πŸŽ‰

You can fork any of the :octocat: repositories below, go to your profile page, activate it, start committing to GitHub and see your Travis builds running.

Build Stages -

πŸ“– You can find information and examples in our Build Stages Docs.

Building a multi-platform release with Travis and Docker

This example tests a Rust binary on multiple targeted platforms using Docker, and if the tests pass, release it to GitHub Releases. Demo credit goes to the fantastic @joecorcoran - thank you!

  • :octocat: https://github.com/joecorcoran/travis-docker-demo

  • Build Status

    .travis.yml file used:

    language: rust
    
    services: docker
    
    branches:
      only:
        - master
    
    # Install tools for running tests
    install:
      - cargo install cross
    
    # Setup jobs per platform
    jobs:
      include:
        # 64-bit tests
        - &test
          stage: test
          script: cross test --target $TARGET
          env: TARGET=x86_64-unknown-linux-gnu
        # 32-bit tests
        - <<: *test
          env: TARGET=i686-unknown-linux-gnu
        # 64-bit release
        - &deploy
          stage: deploy
          env: TARGET=x86_64-unknown-linux-gnu
          script: skip
          before_deploy:
            - cross build --release --target $TARGET
            - cp target/$TARGET/release/travis-docker-demo .
            - tar czf travis-docker-demo-$TARGET-$TRAVIS_BUILD_NUMBER.tar.gz travis-docker-demo
            - TRAVIS_TAG=build-$TRAVIS_BUILD_NUMBER
          deploy:
            api_key:
              secure: "..."
            file: travis-docker-demo-$TARGET-$TRAVIS_BUILD_NUMBER.tar.gz
            provider: releases
            skip_cleanup: true
        # 32-bit release
        - <<: *deploy
          env: TARGET=i686-unknown-linux-gnu
    
  • πŸŽ₯ Example demo available here

DEMO πŸ• TIME

Credit goes to the amazing @lislis, thank you!

Pizza site (Ember Application - built on the top of the pizza server)

Pizza Server (Crystal lang, deployed to NPM)

.travis.yml file used

```
language: crystal

jobs:
  include:
    - stage: build
      script: crystal build --release src/pizza-server.cr
    - stage: deploy
      script: skip
      deploy: &heroku
        provider: heroku
        app: berlin-pizza
        api_key: $HEROKU_AUTH_TOKEN
        on:
          branch: master
    - stage: npm publish
      script: skip
      deploy:
        provider: npm
        api_key: $NPM_API_KEY
        email: $EMAIL
        on:
          branch: master
          tags: true
```

Building and deploying a Jekyll site

Cron jobs

You can schedule builds in Travis CI:

Demo credit goes to the wonderful @aakritigupta, thank you!

What else?

Play, test, build, deploy!

πŸ“– Learn some more in our documentation: Travis CI Docs

πŸ“° Don't miss any new features, checkout the Travis CI Blog

🐦 @travisci in Twitter

Questions? Drop us a line at support@travis-ci.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment