version: 2
  jobs:
    test:
      docker:
        - image: circleci/node:12.16
      steps:
        - checkout
        - run: echo "Running tests"
        - run: npm install
        - run: npm test
      build:
        docker:
          - image: circleci/node:12.16
        steps:
          - checkout
          - run: echo "build project"
          - npm install
          - npm run build
workflows:
  version: 2
    test_build:
      jobs:
        - test
        - build:
          requires:
            - test
上面的YAML是CircleCI的config.yml,但出现此错误
配置不符合架构:{:workflows {:test_and_build {:jobs [nil {:build(not(map?nil)),:requires(not(map?a-clojure.lang.LazySeq))}}}}} }
请问我做错了什么?我需要帮助。我是CircleCI的新手
谢谢
另一个观察结果是,如果我并行运行作业,则它们运行时不会出现任何错误。
也就是说,如果我删除了要求:-如下所示进行测试
workflows:
  version: 2
    test_build:
      jobs:
        - test
        - build

最佳答案

build是一项工作,就像test一样,应该以相同的方式缩进:

version: 2
  jobs:
    test:
      docker:
        - image: circleci/node:12.16
      steps:
        - checkout
        - run: echo "Running tests"
        - run: npm install
        - run: npm test
    build:
      docker:
        - image: circleci/node:12.16
      steps:
        - checkout
        - run: echo "build project"
        - npm install
        - npm run build

workflows:
  version: 2
    test_build:
      jobs:
        - test
        - build:
          requires:
            - test

关于node.js - Node.js的CircleCI config.yml,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62732682/

10-13 02:41