Circle ci Workflow Build error. Matrix and Name parameters not working

553 Views Asked by At

Does anyone know why this script isn't working?

version: 2.1

orbs:
  android: circleci/[email protected]
  gcp-cli: circleci/[email protected]

jobs:
  build:
    working_directory: ~/code
    docker:
      - image: cimg/android:2022.04
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD  
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - run:
         name: Chmod permissions 
         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results

  nightly-android-test:
    parameters:
      system-image:
        type: string
        default: system-images;android-30;google_apis;x86
    executor:
      name: android/android-machine
      resource-class: xlarge
    steps:
      - checkout
      - android/start-emulator-and-run-tests:
          test-command: ./gradlew connectedDebugAndroidTest
          system-image: << parameters.system-image >>
      - run:
          name: Save test results
          command: |
            mkdir -p ~/test-results/junit/
            find . -type f -regex ".*/build/outputs/androidTest-results/.*xml" -exec cp {} ~/test-results/junit/ \;
          when: always
      - store_test_results:
          path: ~/test-results
      - store_artifacts:
          path: ~/test-results/junit

workflows:
  unit-test-workflow:
    jobs:
      - build
  nightly-test-workflow:
    triggers:
      - schedule:
          cron: "0 0 * * *"
          filters:
            branches:
              only:
                - develop
    jobs:
      - nightly-android-test: 
          matrix:
            alias: nightly
            parameters:
              system-image:
                - system-images;android-30;google_apis;x86
                - system-images;android-29;google_apis;x86
                - system-images;android-28;google_apis;x86
                - system-images;android-27;google_apis;x86
          name: nightly-android-test-<<matrix.system-image>>

I keep getting the following build error:

Config does not conform to schema: {:workflows {:nightly-test-workflow {:jobs 
[{:nightly-android-test {:matrix disallowed-key, :name disallowed-key}}]}}}

The second workflow seems to fail due to the matrix and name parameters but I can't see anything wrong in the script that would make them fail. I've tried looking at a yaml parser and couldn't see any null vaules and I tried the circle ci discussion forum with not a lot of luck.

1

There are 1 best solutions below

0
On

I don't think that's the correct syntax. See the CircleCI documentation:

According to the above references, I believe it should be:

      - nightly-android-test: 
          matrix:
            alias: nightly
            parameters:
              system-image: ["system-images;android-30;google_apis;x86", "system-images;android-29;google_apis;x86", "system-images;android-28;google_apis;x86", "system-images;android-27;google_apis;x86"]
          name: nightly-android-test-<<matrix.system-image>>