CircleCI-Public / config-preview-sdk

Preview SDK for orb authors
85 stars 29 forks source link

Parellization not working #138

Closed kylemh closed 3 years ago

kylemh commented 3 years ago

Here is my config:

version: 2.1

orbs:
  cypress: cypress-io/cypress@1

executors:
  default:
    resource_class: large
    docker:
      - image: cypress/base:14.10.1 # keep in sync with .nvmrc and any other executors

parameters:
  workspace_root:
    type: string
    default: '~/'
  primary_cache_key:
    type: string
    default: 'air/next-{{ .Branch }}-{{ checksum "yarn.lock" }}'
  backup_cache_key:
    type: string
    default: 'air/next-{{ .Branch }}-'
  org_level_cache_key:
    type: string
    default: 'air/next-'

exclude_main: &exclude_main
  filters:
    branches:
      ignore: main

aliases:
  - &attach_workspace
    attach_workspace:
      at: << pipeline.parameters.workspace_root >>

  - &restore_cache
    restore_cache:
      keys:
        - << pipeline.parameters.primary_cache_key >>
        # Fallback in case checksum fails.
        - << pipeline.parameters.backup_cache_key >>
        - << pipeline.parameters.org_level_cache_key >>
  - &yarn_install
    run:
      name: 'Installing dependencies...'
      command: yarn install --non-interactive --frozen-lockfile --cache_folder << pipeline.parameters.workspace_root >>.cache/yarn

  - &create_npmrc
    run:
      name: 'Create .npmrc to set NPM_TOKEN...'
      command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

jobs:
  install_dependencies:
    executor: default
    steps:
      - checkout
      - *attach_workspace
      - *create_npmrc
      - *restore_cache
      - *yarn_install
      - run: node --version
      - run: yarn --version
      - run: pwd && echo '' && ls -al
      - save_cache:
          key: << pipeline.parameters.primary_cache_key >>
          paths:
            - node_modules
            - << pipeline.parameters.workspace_root >>.cache/yarn
            - << pipeline.parameters.workspace_root >>.cache/Cypress

workflows:
  ci:
    jobs:
      - install_dependencies:
          <<: *exclude_main

      - cypress/run:
          <<: *exclude_main
          name: integration_tests
          requires:
            - install_dependencies
          executor: default
          pre-steps:
            - checkout
            - *attach_workspace
            - *restore_cache
            - *yarn_install
          store_artifacts: true
          attach-workspace: true
          record: true # record results on Cypress Dashboard
          parallel: true # split all specs across machines
          parallelism: 4 # use X number of CircleCI machines
          command-prefix: yarn # dont use npx
          group: 'all tests' # name this group "all tests" on the dashboard
          start: 'NODE_OPTIONS="--max_old_space_size=4096" yarn build && yarn start' # start server before running tests
          wait-on: http://localhost:3000 # wait until server is ready

While 4 machines do spin up, build, start, and run the Cypress executable, only one actually runs Cypress against my spec files.

See how 1 is much longer than the others? Screen Shot 2020-12-17 at 12 07 10 AM

Screen Shot 2020-12-17 at 12 07 33 AM

kylemh commented 3 years ago

i have NO idea how i ended up posting this here - my bad