【问题标题】:circleci only 1 subschema matches out of 2circleci 只有 1 个子模式匹配 2 个
【发布时间】:2021-04-17 17:13:02
【问题描述】:

我正在尝试为我的电子应用程序创建一个 circleci 自动化测试。
我按照这里的说明进行操作:https://circleci.com/blog/electron-testing/
我的仓库:https://github.com/dhanyn10/electron-example/tree/spectron
我的项目文件夹是这样的

electron-example
|──/.circleci
|  |──config.yml
|──/bootbox
|──/project1
|──/project2

因为在我的项目中包含许多应用程序,我需要在文件夹中指定要测试的应用程序。这是我的circleci配置

version: 2.1
jobs:
  build:
    working_directory: ~/electron-example/bootbox
    docker:
      - image: circleci/node:11-browsers
    steps:
      - checkout:
        path: ~/electron-example
      - run:
          name: Update NPM
          command: "sudo npm install -g npm"
      - restore_cache:
          key: dependency-cache-{{ checksum "package-lock.json" }}
      - run:
          name: Install Dependencies
          command: npm install
      - save_cache:
          key: dependency-cache-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Run tests
          command: npm run test

package.json

...
  "devDependencies": {
    "electron": "^11.4.3",
    "electron-builder": "^22.10.4",
    "mocha": "^8.3.2",
    "spectron": "^13.0.0"
  },
...

它在下面返回错误

#!/bin/sh -eo pipefail
# ERROR IN CONFIG FILE:
# [#/jobs/build] only 1 subschema matches out of 2
# 1. [#/jobs/build/steps/0] 0 subschemas matched instead of one
# |   1. [#/jobs/build/steps/0] extraneous key [path] is not permitted
# |   |   Permitted keys:
# |   |     - persist_to_workspace
# |   |     - save_cache
# |   |     - run
# |   |     - checkout
# |   |     - attach_workspace
# |   |     - store_test_results
# |   |     - restore_cache
# |   |     - store_artifacts
# |   |     - add_ssh_keys
# |   |     - deploy
# |   |     - setup_remote_docker
# |   |   Passed keys:
# |   |     []
# |   2. [#/jobs/build/steps/0] Input not a valid enum value
# |   |   Steps without arguments can be called as strings
# |   |     enum:
# |   |     - checkout
# |   |     - setup_remote_docker
# |   |     - add_ssh_keys
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code exit status 1
CircleCI received exit code 1

如何解决这个错误?

【问题讨论】:

    标签: electron circleci spectron


    【解决方案1】:

    见:

    这里有点晚了,但结帐默认为working_directory

          - checkout:
            path: ~/electron-example
    

    应该是:

          - checkout
    

    我也因为以下原因来到这里,试图添加浏览器工具:

    workflows:
      build-and-test:
        jobs:
          - build
          - pylint
          - tslint
          - karma
          - jest
          - unit-tests
          - functional-tests:
              requires:
                - build
          - deploy:
              requires:
                - build
        orbs:
            browser-tools-blah
    

    应该是:

    orbs:
        browser-tools-blah
    
    workflows:
      build-and-test:
        jobs:
          - build
          - pylint
          - tslint
          - karma
          - jest
          - unit-tests
          - functional-tests:
              requires:
                - build
          - deploy:
              requires:
                - build
    

    【讨论】:

    • 好的,谢谢。我稍后会尝试。抱歉迟到了评论,因为我要为其他项目工作。
    猜你喜欢
    • 2022-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多