CircleCI:在 .yml 文件中为同一存储库中的多个项目设置工作目录

CircleCI: Set working directory in .yml file for multiple projects on same repository

V1 目录中有一个 android 项目。我想 运行 使用 circle.yml 文件进行 lint 检查和存储工件。我的 circle.yml 文件位于 GitHub 存储库的根目录 (e.i repository/Android) 中。我有 3 个分支用于 V1 Android 项目 e.i Master、QA 和 Develop。

下面是我的 develop 分支的 yml 文件。

version: 2
jobs:
  build_develop:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout:
          path: ~/V1
      - restore_cache:
          key: jars-{{ checksum "V1/build.gradle" }}-{{ checksum  "V1/app/build.gradle" }}
      - run:
          name: Download Dependencies
          command: ./V1/gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "V1/build.gradle" }}-{{ checksum  "V1/app/build.gradle" }}
      - run:
          name: Run lint
          command: |
            ./gradlew lintDebug
      - store_artifacts:
          path: app/build/reports
          destination: reports/
      - run:
          name: Run build
          command: |
            ./gradlew assembleDebug
      - store_artifacts:
          path: app/build/outputs/apk
          destination: apks/

workflows:
  version: 2

  build_app:
    jobs:
      - build_develop:
          filters:
            branches:
              only:
                - develop

它在 CircleCI 构建仪表板中给出如下错误,

我想,我在设置 working_directory: path 和 checkout: path: 时犯了一些错误。我不知道如何为这种情况设置正确的路径。

提前致谢。

这里,项目结构已经有V1文件夹。签出时,您正在代码文件夹中再次创建 V1 文件夹以签出。我们可以通过删除结帐路径来解决此问题,如下所示。

steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "V1/build.gradle" }}-{{ checksum  "V1/app/build.gradle" }}