Skip to content

Instantly share code, notes, and snippets.

@AhsanAyaz
Last active January 3, 2020 00:20
Show Gist options
  • Save AhsanAyaz/820d40da5d1aa45c138f9e55d5193d34 to your computer and use it in GitHub Desktop.
Save AhsanAyaz/820d40da5d1aa45c138f9e55d5193d34 to your computer and use it in GitHub Desktop.
Sample TravisCI Yaml file for Angular Project
language: node_js
node_js:
- "7"
sudo: true
dist: trusty
branches:
only:
- master
before_script:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
script:
- ng test --watch false -cc
- npm run e2e
- ng build -bh "https://ahsanayaz.github.io/ng-traffic-ci/"
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
local_dir: dist
on:
branch: master
@julie-ng
Copy link

julie-ng commented Mar 4, 2018

My .travis.yml is cleaner:

language: node_js
node_js:
  - "8"
dist: trusty
sudo: false

cache:
  directories:
    - node_modules

addons:
  chrome: stable

script:
  - npm run lint
  - npm run test:headless
  - npm run build
  - xvfb-run npm run e2e

You can avoid all the setup by using Travis' Chrome addon and their provided xvfb-run wrapper.

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