To start using Travis CI, make sure you have a GitHub account and your GitHub account is added to the AICS organization. Also, you should have at least one project hosted on GitHub.
.travis.yml
file to your repository to tell Travis CI what to do..travis.yml
file to git, commit and push, to trigger a Travis CI build.Selecting a programming language or runtime such as Java or Node.js.
# Java .travis.yml sample
language: java
# Node.js .travis.yml sample
language: node_js
Specifying versions
# Java .travis.yml sample
language: java
jdk:
- openjdk8
# Node.js .travis.yml sample
language: node_js
node_js:
- "10"
Installing Dependencies
To install Ubuntu packages that are not included in the standard trusty or xenial distribution, use apt-get in the before_install step of your .travis.yml
before_install:
- sudo apt-get update
- sudo apt-get install -y mongodb-org
Write your commands in the script section
# Java .travis.yml sample
language: java
jdk:
- openjdk8
script:
- gradle build
# Node.js .travis.yml sample
language: node_js
node_js:
- "10"
script:
- npm test
jobs:
include:
# You can name your stages.
- stage: "RUN MY TESTS"
script: ./test
# Unique stage names are recommended.
- stage: "DEPLOY MY APP"
script: ./deploy
jobs:
include:
- stage: "RUN MY TESTS"
script: ./test
- stage: "DEPLOY MY APP"
# Conditional stages
if: branch = master
script: ./deploy
Configuring Build Notifications
Travis CI can notify you about your build results through email or custom webhooks.
notifications:
# Notifications through email
email:
- one@example.com
- other@example.com
# Notifications through webhooks
webhooks:
- http://your-domain.com/notifications
- http://another-domain.com/notifications
Full basic .travis.yml sample
# Java .travis.yml sample
language: java
jdk:
- openjdk8
notifications:
email:
- one@example.com
webhooks:
- http://your-domain.com/notifications
before_install:
- sudo apt-get update
- sudo apt-get install -y YOUR_DEPENDENCY
jobs:
include:
- stage: "RUN MY TESTS"
script: ./test
- stage: "DEPLOY MY APP"
if: branch = master
script: ./deploy
Travis CI can send notifications to your MS Teams channels about build results.
Note that you may need to ask MIS for permission to add new connectors in your Teams channel.
notifications:
webhooks:
- http://your-teams-webhook-url