我正在尝试在矩阵中使用Travis阶段,但似乎使用的脚本是默认的(npm run test
),除了一个。
这里是travis.yml
if: tag IS blank
git:
depth: 1
sudo: false
matrix:
fast_finish: true
cache: yarn
language: node_js
node_js:
- "node"
- "lts/*"
env:
- COMPONENT=@emmanuelgautier/lerna-example-hapi
- COMPONENT=@emmanuelgautier/lerna-example-react-app
- COMPONENT=@emmanuelgautier/lerna-example-validators
stages:
- test
- build
- name: publish
if: branch = master
jobs:
include:
- script: yarn bootstrap --scope=$COMPONENT && yarn lerna run --scope=$COMPONENT test:ci
- stage: build
script: yarn lerna --scope=$COMPONENT build
- stage: publish
env:
- COMPONENT=all
script: yarn publish
- stage: deploy
script: skip
此处有一个示例问题:https://travis-ci.org/emmanuelgautier/lerna-example/builds/355884540
您认为错误是来自travis文件还是因为此功能处于测试版模式?
答案 0 :(得分:1)
由于script
未在顶层定义,因此默认用于未明确定义的作业(使用node
和lts/*
的6个作业 - 和3 env
阶段test
vars。如果您需要自定义script
,请在顶层添加一个。
答案 1 :(得分:1)
对不起,我在第一个问题上并不清楚。我的需要是在每个阶段扩展矩阵。目前看来这是不可能的(https://github.com/travis-ci/travis-ci/issues/8295)。
找到的解决方法如下(没有矩阵扩展)
if: tag IS blank
sudo: false
git:
depth: 1
matrix:
fast_finish: true
cache: yarn
language: node_js
node_js:
- "node"
jobs:
include:
- stage: test
node_js: "node"
env: COMPONENT=@emmanuelgautier/lerna-example-hapi
script: ./ci/test $COMPONENT
- stage: test
node_js: "lts/*"
env: COMPONENT=@emmanuelgautier/lerna-example-hapi
script: ./ci/test $COMPONENT
- stage: test
node_js: "node"
env: COMPONENT=@emmanuelgautier/lerna-example-react-app
script: ./ci/test $COMPONENT
- stage: test
node_js: "lts/*"
env: COMPONENT=@emmanuelgautier/lerna-example-react-app
script: ./ci/test $COMPONENT
- stage: test
node_js: "node"
env: COMPONENT=@emmanuelgautier/lerna-example-validators
script: ./ci/test $COMPONENT
- stage: test
node_js: "lts/*"
env: COMPONENT=@emmanuelgautier/lerna-example-validators
script: ./ci/test $COMPONENT
- stage: build
node_js: "node"
env: COMPONENT=@emmanuelgautier/lerna-example-hapi
script: ./ci/build $COMPONENT
- stage: build
node_js: "lts/*"
env: COMPONENT=@emmanuelgautier/lerna-example-hapi
script: ./ci/build $COMPONENT
- stage: build
node_js: "node"
env: COMPONENT=@emmanuelgautier/lerna-example-react-app
script: ./ci/build $COMPONENT
- stage: build
node_js: "lts/*"
env: COMPONENT=@emmanuelgautier/lerna-example-react-app
script: ./ci/build $COMPONENT
- stage: build
node_js: "node"
env: COMPONENT=@emmanuelgautier/lerna-example-validators
script: ./ci/build $COMPONENT
- stage: build
node_js: "lts/*"
env: COMPONENT=@emmanuelgautier/lerna-example-validators
script: ./ci/build $COMPONENT
- stage: publish
script: skip
- stage: deploy
script: skip
stages:
- test
- build
- name: publish
if: branch = master