Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Github Repository Structure

There is an android project in V1 directory. I want to run lint check and store artifacts using circle.yml file. I have my circle.yml file in root directory (e.i repository/Android) of GitHub repo. I have 3 branches for V1 Android project e.i Master, QA and Develop.

Below is my yml file for develop branch.

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

It gives error like below in CircleCI build dashboard,

Error of build

I think, i made some mistake in setting working_directory: path and checkout: path:. I don't know that how to set correct path for this scenario.

Thanks in advance.

like image 428
Chirag Chavda Avatar asked Oct 30 '22 01:10

Chirag Chavda


1 Answers

Here, The project structure already has V1 folder. While checking out you are creating V1 folder again in code folder to check out. We can resolve this by removing Checkout path like below.

steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "V1/build.gradle" }}-{{ checksum  "V1/app/build.gradle" }}
like image 74
Venugopal Reddy D Avatar answered Nov 09 '22 06:11

Venugopal Reddy D