Usage with Travis CI `stage` and `jobs` feature
Closed this issue · 2 comments
poupryc commented
Hi,
I would like to implement the package-lock.json support with Greenkeeper, however, I would like to use the courses with the conditions to be able to optimize the build.
Currently, my travis.yml
looks like this:
language: node_js
node_js:
- 10
- 9
- 8
notifications:
email: false
cache:
directories:
- ~/.npm
script:
- npm run build -- --noEmit # test typescript
- npm run test # run test
- npm run coverage # run coverage
branches:
only:
- master
- dev
- /^greenkeeper.*$/
jobs:
include:
- stage: deploy
if: branch = master # only deploy the code that is on master
script:
- npm run build # build TS
- npm run release # run release process
I was wondering if it was possible to do something like, using stage & jobs and conditional build.
language: node_js
node_js:
- 10
- 9
- 8
notifications:
email: false
cache:
directories:
- ~/.npm
script:
- npm run build -- --noEmit # test typescript
- npm run test # run test
- npm run coverage # run coverage
branches:
only:
- master
- dev
- /^greenkeeper.*$/
jobs:
include:
# stage will be executed only if the tests are successful
- stage: greenkeeper
if: branch =~ /^greenkeeper.*$/ # test if branch its greenkeeper's branch
script:
- npm install -g greenkeeper-lockfile
- # do lockfile update & upload
- stage: deploy
if: branch = master # only deploy the code that is on master
script:
- npm run build # build TS
- npm run release # run release process
I hope some of you can enlighten me.
Thank you for your work with greenkeeper ❤️
freaktechnik commented
I'd assume something like
- stage: greenkeeper
if: branch =~ /^greenkeeper.*$/ # only run if in a greenkeeper branch
before_install: npm i -g greenkeeper-lockfile
install: npm i # always run full install for greenkeeper
script:
- greenkeeper-lockfile-update
- greenkeeper-lockfile-upload
would work, however I've not had a chance to see it work or fail. Also nicely solves the npm ci problem.
Edit: you will also have to force npm i in all other steps, though.
poupryc commented
Thanks for your comment !
I don't want to risk breaking my deployment workflow. I'd like someone else's opinion if possible ^^.