Skip to content

cheatsheetz/travis-ci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Travis CI Cheat Sheet

Basic .travis.yml

language: node_js
node_js:
  - "16"
  - "18"
  - "20"

os:
  - linux
  - osx

cache:
  directories:
    - node_modules

before_script:
  - npm install -g eslint

script:
  - npm test
  - eslint .

after_success:
  - npm run coverage

jobs:
  include:
    - stage: test
      script: npm test
    - stage: deploy
      script: skip
      deploy:
        provider: heroku
        api_key: $HEROKU_API_KEY
        app: my-app-staging
        on:
          branch: develop
    - stage: deploy
      script: skip
      deploy:
        provider: s3
        access_key_id: $AWS_ACCESS_KEY_ID
        secret_access_key: $AWS_SECRET_ACCESS_KEY
        bucket: my-s3-bucket
        skip_cleanup: true
        on:
          branch: main

env:
  global:
    - NODE_ENV=test
  matrix:
    - TEST_SUITE=unit
    - TEST_SUITE=integration

services:
  - docker
  - postgresql
  - redis-server

addons:
  postgresql: "13"
  apt:
    packages:
      - postgresql-13
      - postgresql-client-13

notifications:
  email:
    - [email protected]
  slack: team:token#channel

Advanced Configuration

# Build matrix
matrix:
  include:
    - os: linux
      dist: ubuntu
      sudo: required
    - os: osx
      osx_image: xcode12
  allow_failures:
    - os: osx
  fast_finish: true

# Conditional builds
if: branch = main OR type = pull_request

# Custom deployment
deploy:
  - provider: script
    script: ./deploy.sh staging
    on:
      branch: develop
  - provider: script
    script: ./deploy.sh production
    on:
      branch: main
      condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$

Official Links

About

Repo for travis-ci

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published