Hi friends, a newbie to Travis here. I have a following Angular CI config, and I have three questions:
- is the
CODECOV_TOKEN=$CODECOV_TOKEN
here unnecessary since it is already exported from the settings? - I only want to run the
Deploy
stage on master branch, but the stage is still triggered on other branch, soif: branch = master
is not working here? - I want to install chrome by default and now used in
Test
stage, but override it and installgettext-base
package in theDeploy
phase, how can I achieve this nicely?
Any other optimization tips are greatly appreciated
dist: trusty
sudo: false
language: node_js
node_js:
- "12"
addons:
chrome: stable
apt:
update: true
packages:
- gettext-base
env:
global:
CODECOV_TOKEN=$CODECOV_TOKEN
cache:
directories:
- ./node_modules
install:
- npm install
stages:
- name: Lint & Test
- name: Deploy to Firebase
if: branch = master
jobs:
include:
- stage: Lint & Test
script:
- npm run lint
- stage: Lint & Test
script:
- npm run test -- --no-watch --no-progress --code-coverage --browsers=ChromeHeadless
after_script:
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./node_modules/.bin/codecov; fi
- stage: Deploy to Firebase
skip_cleanup: true
script:
- npm run build -- --prod --output-path=dist
before_deploy:
- envsubst < ./dist/assets/env.template.js > ./dist/assets/env.js
deploy:
provider: firebase
token: $FIREBASE_TOKEN
edge: true
An example pipeline here