【发布时间】:2018-11-18 01:13:06
【问题描述】:
我正在使用lerna.js,但我很难找到有关使用Travis 设置monorepo 的适当文档。我只找到了这个repo 和这个blog post,但它们都是最小的和次优的。
我怎样才能完成以下所有任务?
- 跨所有包运行测试和 linter
- 在每个包中缓存
node_modules - 最好为每个包声明一个不同的
.travis.yml文件
我设法做到了第 1 点:
env:
matrix:
- PACKAGE=contracts
matrix:
include:
- stage: tests
name: "unit tests"
script:
- cd packages/contracts
- npm install && npm run test
- stage: tests
name: "unit tests with coverage"
script:
- cd packages/contracts
- npm install && npm run test
env: SOLIDITY_COVERAGE=true
- stage: tests
name: "static tests"
script:
- cd packages/contracts
- npm install && npm run lint
但是,构建速度非常慢,因为 node_modules 没有被缓存。同样,以自上而下的方式声明所有测试是一个相当冗长的过程,我更喜欢通过单独的 .travis.yml 文件自下而上。
【问题讨论】: