Reputation: 329
I have a repository that has 2 subfolders and in each subfolder is a different app. I want to make a .travis.yml
config that goes in each subfolders and does the following:
cd subfolder1
npm install
npm test
npm run build
And do the same thing for the second folder
cd subfolder2
npm install
npm test
npm run build
I could not find anything regarding to this setup. Can someone please help me? Any idea will be greatly appreciated!
This is my current config setup only for one subfolder:
before_install
- cd subfolder 1
language: node_js
node_js:
- "stable"
cache:
directories:
- "$HOME/.npm"
script:
- npm test
- npm run build
on:
branch: master
Upvotes: 1
Views: 773
Reputation: 329
After reading @tbking's answer I came up with a config file that works pretty well.
language: node_js
node_js:
- "stable"
cache:
directories:
- "$HOME/.npm"
matrix:
fast_finish: true
include:
- env: ECMAScript
before_script:
- cd ${TRAVIS_BUILD_DIR}/templates/ECMAScript
- npm install
script:
- npm test
- npm run build
- env: TypeScript
before_script:
- cd ${TRAVIS_BUILD_DIR}/templates/TypeScript
- npm install
script:
- npm test
- npm run build
on:
branch: master
Upvotes: 3
Reputation: 9086
You could add all these steps to a lifecycle hook like before_install.
before_install
- cd ./subfolder1
- npm install
- npm test
- npm run build
- cd ./subfolder2
- npm install
- npm test
- npm run build
You can also do the testing and building part of both these projects in script
section, but the idea is that you need to manage yourself the sequence of actions performed. This will render install
stage just a placeholder.
Upvotes: 1