-
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.
-
Setting up a deployment pipeline π Check out Build Stages
Some workflows tips and tricks!
-
Build Pull Requests πͺ
-
Automatically Cancel pull request builds waiting to start.
-
Protect your default (main/master?) branch in GitHub, to ensure your tests run before the pull requested is merged.
There's more information available at: https://help.github.com/articles/enabling-required-status-checks/
You can fork any of the repositories below, go to your profile page, activate it, start committing to GitHub and see your Travis builds running.
-
Using Build Stages in both an Ember Application running in a Crystal Server:
-
Cron Jobs - scheduling builds
π You can find information and examples in our Build Stages Docs.
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!
-
.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
Credit goes to the amazing @lislis, thank you!
-
π https://travis-ci.org/lislis/quattro-stagione
.travis.yml
file usedlanguage: node_js node_js: - '6' - '7' sudo: false cache: directories: - "$HOME/.npm" before_install: - npm config set spin false - npm install -g phantomjs-prebuilt ember-cli - phantomjs --version install: - npm install jobs: include: - stage: test script: ember test - stage: build script: ember build - stage: deploy deploy: &heroku provider: heroku app: quattro-stagione script: skip on: branch: master api_key: secure: ... ```
- https://github.com/lislis/pizza-server
- https://travis-ci.org/lislis/pizza-server
- https://www.npmjs.com/package/berlin-pizza
.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
```
You can schedule builds in Travis CI:
-
π Cron Jobs guide
Demo credit goes to the wonderful @aakritigupta, thank you!
os: windows
exists now!
A Windows Server, version 1803 environment with git bash, powershell, chocolatey to choco install
and language built-in language support for C, C++, Node.js, Rust and Go.
Or customize to prepare your own environment, like Python builds: https://travis-ci.org/gerardcl/renfe-cli/jobs/529890694
For more details: https://docs.travis-ci.com/user/reference/windows
The main source of configuration for your build is the .travis.yml
file stored in your repository.
Additionally, this .travis.yml
supports importing up to 5 YAML sources/snippets that can be shared across repositories. This works using the import
key, which supports the following formats:
#import a single file
import: travis-ci/build-configs/rubies.yml@main
# import multiple files
import:
- travis-ci/build-configs/rubies.yml@adf1235
- travis-ci/build-configs/other.yml@v1
# local imports fetch the same git commit ref
import:
- ./one.yml
- ./other.yml
For example:
- https://github.com/MariadeAnton/imports/blob/invalid-branch/.travis.yml
- https://github.com/rust-lang/rust-forge/blob/master/.travis.yml#L7-L8
- Warm up the cache: https://docs.travis-ci.com/user/build-stages/warm-cache/
cache: bundler
jobs:
include:
- stage: prepare cache
script: true
rvm: 2.3
- stage: test
script: bundle show
rvm: 2.3
- stage: test
script: bundle show
rvm: 2.3
- stage: test
script: bundle show
rvm: 2.3
- Deploying to NPM https://docs.travis-ci.com/user/build-stages/deploy-npm/
language: node_js
node_js:
- "7"
- "6"
- "5"
- "4"
script: echo "Running tests against $(node -v) ..."
jobs:
include:
- stage: npm release
node_js: "7"
script: echo "Deploying to npm ..."
deploy:
provider: npm
api_key: $NPM_API_KEY
on: deploy-npm-release
Ref: https://docs.travis-ci.com/user/build-stages/
Examples: https://docs.travis-ci.com/user/build-stages/#examples
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? Join the Travis CI Community Forum or drop us a line at [email protected]