aurelia/aurelia

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2.1

orbs:
  common: aurelia/common@volatile
  browser-tools: circleci/browser-tools@1.4.7

# # # # # # # # # # # # # # # #
# - Scalar variables -
# # # # # # # # # # # # # # # #
scalar-1: &working_dir ~/repo

# # # # # # # # # # # # # # # #
# - Map variables -
# # # # # # # # # # # # # # # #
map-1: &filter_ignore_develop_release
  filters:
    branches:
      ignore:
        - develop
        - release

map-2: &filter_only_master
  filters:
    branches:
      only:
        - master

map-3: &filter_only_release
  filters:
    branches:
      only:
        - release

map-4: &filter_only_develop
  filters:
    branches:
      only:
        - develop

map-5: &filter_only_tag
  filters:
    branches:
      ignore: /.*/
    tags:
      only: /^v[0-9]+(\.[0-9]+)*(-[\w]+\.[0-9]+)?$/

map-6: &filter_only_topic
  filters:
    branches:
      ignore:
        - master
        - develop
        - release
    tags:
      ignore: /.*/

# # # # # # # # # # # # # # # #
# - Executors -
# # # # # # # # # # # # # # # #
executors:

  docker_circleci:
    parameters:
      node:
        type: string
        default: "18.19.0"
    working_directory: *working_dir
    resource_class: large
    docker:
      - image: "cimg/node:<< parameters.node >>-browsers"

  docker_release:
    working_directory: *working_dir
    resource_class: large
    docker:
      - image: "cimg/node:18.19.0"

  docker_circleci_bench:
    working_directory: *working_dir
    resource_class: large
    docker:
      - image: "cimg/node:18.19.0-browsers"

  docker_playwright_jammy:
    docker:
      - image: mcr.microsoft.com/playwright:v1.39.0-jammy

  docker_verdaccio:
    working_directory: *working_dir
    resource_class: large
    docker:
      - image: "oven/bun"

# # # # # # # # # # # # # # # #
# - Commands -
# # # # # # # # # # # # # # # #
commands:

  checkout_install:
    parameters:
      install:
        type: boolean
        default: true
      install_drivers:
        type: boolean
        default: true
      install_chrome:
        type: boolean
        default: true
      install_firefox:
        type: boolean
        default: true
    steps:
      - checkout
      - when:
          condition:
            and:
              - <<parameters.install_drivers>>
              - <<parameters.install_chrome>>
          steps:
          - browser-tools/install-chrome
          - browser-tools/install-chromedriver
      - when:
          condition:
            and:
              - <<parameters.install_drivers>>
              - <<parameters.install_firefox>>
          steps:
            - browser-tools/install-firefox
            - browser-tools/install-geckodriver
      - run: echo 'export PREFERRED_WORKSPACE_MANAGER=yarn' >> $BASH_ENV
      - when:
          condition: <<parameters.install>>
          steps:
            - run: npm ci

  checkout_install_build_bundle_publish_verdaccio:
    parameters:
      from:
        type: string
      to:
        type: string
      channel:
        type: string
      suffix:
        type: string
        default: ""
      registry:
        type: string
        default: "http://localhost:4873"
    steps:
      - common/configure_git
      # - checkout_install:
      #     install_drivers: false
      - checkout
      - restore_cache:
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          key: cache-{{ .Revision }}-build-true
      # - run: npm run build:release
      # - run: npm run change-tsconfigs:invert
      # - run: npm run build:release
      # - run: npm run change-tsconfigs:restore
      # - run: npm run generate-native-modules
      - clean_merge_commit_dist:
          from: << parameters.from >>
          to: << parameters.to >>
          channel: << parameters.channel >>
          suffix: << parameters.suffix >>
      - common/setup_verdaccio
      - run: npm config set registry << parameters.registry >>
      - run: npm run publish:<< parameters.channel >>

  clean_merge_commit_dist:
    parameters:
      from:
        type: string
      to:
        type: string
      channel:
        type: string
      suffix:
        type: string
        default: ""
      message:
        type: string
        default: "chore(all): add latest build artifacts"
      merge_topic:
        type: boolean
        default: true
      bump_version:
        type: boolean
        default: true
    steps:
      - run: set -o pipefail && git add packages/*/dist packages-tooling/*/dist --force && git status
      - run: set -o pipefail && git stash && git status
      - when:
          condition: << parameters.merge_topic >>
          steps:
            - run: set -o pipefail && git checkout << parameters.from >> && git status
            - run: set -o pipefail && git merge ${CIRCLE_BRANCH}
      - run: set -o pipefail && git checkout << parameters.to >> && git status
      - run: set -o pipefail && git reset --hard origin/<< parameters.to >> && git status
      - run: set -o pipefail && git merge << parameters.from >> --no-ff --no-edit -Xtheirs && git status
      - run: set -o pipefail && rm -rf packages/*/dist packages-tooling/*/dist && git status
      - run: set -o pipefail && git add . && git status
      - run: set -o pipefail && git checkout stash -- . && git status
      - run: set -o pipefail && git add packages/*/dist packages-tooling/*/dist --force && git status
      # - run: set -o pipefail && npm run change-package-refs:release -- none
      - when:
          condition: << parameters.bump_version >>
          steps:
            - run: set -o pipefail && npm run bump-version:<< parameters.channel >> -- << parameters.suffix >>
      - run: set -o pipefail && git add . && git status
      - run: set -o pipefail && git commit --allow-empty -m "<< parameters.message >>" && git status

# # # # # # # # # # # # # # # #
# - Jobs -
# # # # # # # # # # # # # # # #
jobs:
  checkout_install_cache:
    executor: docker_circleci
    steps:
      - checkout
      - restore_cache:
          key: cache-{{ checksum "package-lock.json" }}-install
      - run: |
          # cache restored
          if [[ $(ls -l node_modules | grep -c ^d) -gt 10 ]]; then
            exit 0
          else
            npm ci
          fi
      - save_cache:
          key: cache-{{ checksum "package-lock.json" }}-install
          paths:
            - node_modules
            - packages/__tests__/node_modules

            - packages-tooling/__tests__/node_modules
            - packages-tooling/au/node_modules
            - packages-tooling/babel-jest/node_modules
            - packages-tooling/http-server/node_modules
            - packages-tooling/parcel-transformer/node_modules
            - packages-tooling/plugin-conventions/node_modules
            - packages-tooling/plugin-gulp/node_modules
            - packages-tooling/ts-jest/node_modules
            - packages-tooling/vite-plugin/node_modules
            - packages-tooling/webpack-loader/node_modules

  build_and_cache:
    executor: docker_circleci
    parameters:
      command:
        type: string
        default: npm run build
      release:
        type: boolean
        default: false
      generate_native_modules:
        type: boolean
        default: false
    steps:
      - checkout
      - restore_cache:
          key: cache-{{ checksum "package-lock.json" }}-install
      - when:
          condition:
            equal: [true, << parameters.release >>]
          steps:
            - run: npm run build:release
      - when:
          condition:
            equal: [false, << parameters.release >>]
          steps:
            - run: npm run build
      - run: << parameters.command >>
      - when:
          condition: << parameters.generate_native_modules >>
          steps:
            - run: npm run generate-native-modules
      - save_cache:
          key: cache-{{ .Revision }}-build-<< parameters.release >>
          paths:
            - packages/__tests__/dist
            - packages/addons/dist
            - packages/aurelia/dist
            - packages/compat-v1/dist
            - packages/dialog/dist
            - packages/fetch-client/dist
            - packages/i18n/dist
            - packages/kernel/dist
            - packages/metadata/dist
            - packages/platform/dist
            - packages/platform-browser/dist
            - packages/route-recognizer/dist
            - packages/router/dist
            - packages/router-lite/dist
            - packages/expression-parser/dist
            - packages/runtime/dist
            - packages/template-compiler/dist
            - packages/runtime-html/dist
            - packages/state/dist
            - packages/store-v1/dist
            - packages/testing/dist
            - packages/ui-virtualization/dist
            - packages/validation/dist
            - packages/validation-html/dist
            - packages/validation-i18n/dist
            - packages/web-components/dist

            - packages-tooling/__tests__/dist
            - packages-tooling/au/dist
            - packages-tooling/babel-jest/dist
            - packages-tooling/http-server/dist
            - packages-tooling/parcel-transformer/dist
            - packages-tooling/plugin-conventions/dist
            - packages-tooling/plugin-gulp/dist
            - packages-tooling/ts-jest/dist
            - packages-tooling/vite-plugin/dist
            - packages-tooling/webpack-loader/dist

  unit_test_esm:
    parameters:
      coverage:
        type: boolean
        default: true
      npm_command:
        type: string
        default: "test"
      install_chrome:
        type: boolean
        default: false
      install_firefox:
        type: boolean
        default: false
    executor: docker_circleci
    parallelism: 4
    steps:
      - checkout_install:
          install_chrome: <<parameters.install_chrome>>
          install_firefox: <<parameters.install_firefox>>
          install: false
      # instead of doing the following 2 commands
      # # - checkout_install
      # # - run: npm run build
      # just restore some cache from previous steps
      - restore_cache:
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          key: cache-{{ .Revision }}-build-true
      - run:
          name: "Split test glob"
          command: |
            # the following 2 lines work, but the test break on this mode, not in local though
            # it's quite hard to debug on this mode so not using for now
            # echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=timings --timings-type=filename)
            # echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=timings --timings-type=filename) > packages/__tests__/tests.txt
            echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=name)
            echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=name) > packages/__tests__/tests.txt
      - run:
          name: "Run unit tests"
          command: |
            cd packages/__tests__
            npm run << parameters.npm_command >>
          no_output_timeout: "3m"

      - when:
          condition: << parameters.coverage >>
          steps:
            - run:
                name: "Process coverage for Codecov"
                command: |
                  node_modules/codecov/bin/codecov -f packages/__tests__/coverage/coverage-final.json
                when: always
            - store_test_results:
                path: packages/__tests__/coverage
            - store_artifacts:
                path: packages/__tests__/coverage/test-results.xml
                destination: test-results

  unit_test_esm_node:
    executor: docker_circleci
    parallelism: 4
    steps:
      - checkout_install:
          install_chrome: false
          install_firefox: false
          install: false
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          key: cache-{{ .Revision }}-build-true
      - run:
          name: "Split test glob"
          command: |
            # # echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=timings --timings-type=filename)
            # # echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=timings --timings-type=filename) > packages/__tests__/tests.txt
            # echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=name)
            # echo $(circleci tests glob "packages/__tests__/dist/**/*.spec.js" | circleci tests split --split-by=name) > packages/__tests__/tests.txt
            cd packages/__tests__
            echo $(circleci tests glob "dist/**/*.spec.js" | circleci tests split --split-by=timings)
            echo $(circleci tests glob "dist/**/*.spec.js" | circleci tests split --split-by=timings) > tests.txt
      - run:
          name: "Run unit tests"
          command: |
            cd packages/__tests__
            npm run ::mocha -- $(cat tests.txt)
          no_output_timeout: "1m"

  unit_test_cjs:
    parameters:
      npm_command:
        type: string
        default: "test"
      submodules:
        type: boolean
        default: false
    executor: docker_circleci
    steps:
      - checkout_install:
          install_chrome: false
          install_firefox: false
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          key: cache-{{ .Revision }}-build-true
      # - run: npm run build
      # - run: npm run change-tsconfigs:invert
      # - run: npm run build
      # - run: npm run change-tsconfigs:restore
      # - run: npm run change-package-refs:release -- none
      - when:
          condition: << parameters.submodules >>
          steps:
            - run:
                name: "Pull Submodules"
                command: |
                  git submodule init
                  git submodule update --remote
      - run:
          name: "Run unit tests"
          command: |
            cd packages-tooling/__tests__
            npm run << parameters.npm_command >>
          no_output_timeout: "1m"

  lint_packages:
    executor: docker_circleci
    steps:
      - checkout_install:
          install_drivers: false
          install: false
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - run: npm run lint:ci
      - run: npm run lint:other:ci

  merge_and_dist:
    executor: docker_release
    parameters:
      from:
        type: string
      to:
        type: string
      channel:
        type: string
      push:
        type: boolean
        default: false
      merge_topic:
        type: boolean
        default: true
      bump_version:
        type: boolean
        default: true
      dist_file_name:
        type: string
        default: dist
    steps:
      - run: git config --global user.email "aurelia@bluespire.com"
      - run: git config --global user.name "AureliaEffect"
      - run: git config --global core.mergeoptions "--no-edit"
      - checkout
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          # build-true = build + generate native modules
          key: cache-{{ .Revision }}-build-true
      # - run: set -o pipefail && npm run build:release
      # - run: set -o pipefail && npm run change-tsconfigs:invert
      # - run: set -o pipefail && npm run build:release
      # - run: set -o pipefail && npm run change-tsconfigs:restore
      - run: set -o pipefail && npm run generate-native-modules
      - clean_merge_commit_dist:
          from: << parameters.from >>
          to: << parameters.to >>
          channel: << parameters.channel >>
          merge_topic: << parameters.merge_topic >>
          bump_version: << parameters.bump_version >>
      - when:
          condition: << parameters.push >>
          steps:
            - run: git push origin << parameters.to >>

  publish_npm:
    executor: docker_release
    parameters:
      channel:
        type: string
      branch:
        type: string
      swap:
        type: boolean
        default: false
    steps:
      - checkout_install:
          install_drivers: false
      - run: git checkout -- .
      - when:
          condition: << parameters.swap >>
          steps:
            - run: git checkout << parameters.branch >>
            - run: git pull
      - run:
          name: "Authenticate with registry"
          command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
      - run: npm run publish:<< parameters.channel >>

  # e2e hmr
  e2e_test:
    executor: docker_circleci
    parameters:
      path:
        type: string
    steps:
      - checkout_install:
          install_drivers: false
          install: false
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          # build-true = build + generate native modules
          key: cache-{{ .Revision }}-build-true
      - run:
          name: "Run e2e script"
          working_directory: << parameters.path >>
          command: |
            npx playwright install chromium
            npm run test
          no_output_timeout: "1m"

  e2e_safari:
    macos:
      xcode: 14.2.0
    parameters:
      path:
        type: string
    steps:
      - checkout
      - restore_cache:
          key: cache-mac-{{ checksum "package-lock.json" }}-install
      - run: |
          # cache restored
          if [[ $(ls -l node_modules | grep -c ^d) -gt 10 ]]; then
            exit 0
          else
            npm ci
          fi
      - save_cache:
          key: cache-mac-{{ checksum "package-lock.json" }}-install
          paths:
            - node_modules
            - packages/__tests__/node_modules

            - packages-tooling/__tests__/node_modules
            - packages-tooling/au/node_modules
            - packages-tooling/babel-jest/node_modules
            - packages-tooling/http-server/node_modules
            - packages-tooling/parcel-transformer/node_modules
            - packages-tooling/plugin-conventions/node_modules
            - packages-tooling/plugin-gulp/node_modules
            - packages-tooling/ts-jest/node_modules
            - packages-tooling/vite-plugin/node_modules
            - packages-tooling/webpack-loader/node_modules
      # instead of doing the following 2 commands
      # - checkout_install
      # just restore some cache from previous steps
      # - run: chown -R $USER:$USER /home/circleci
      - run: npm run build:release
      - run:
          name: "Run e2e script"
          working_directory: << parameters.path >>
          command: |
            npx playwright install webkit
            npm run test
          no_output_timeout: "1m"

  # Standalone playwright test jobs
  e2e_verdaccio:
    executor: docker_circleci
    parameters:
      path:
        type: string
      suite:
        type: string
        default: "examples"
      use_verdaccio:
        type: boolean
        default: true
      registry:
        type: string
        default: "http://localhost:4873"
    steps:
      - checkout_install_build_bundle_publish_verdaccio:
          from: ${CIRCLE_BRANCH}
          to: develop
          channel: dev
          suffix: "-${CIRCLE_BUILD_NUM}"
      - when:
          condition: << parameters.use_verdaccio >>
          steps:
            - run:
                name: "Install app via verdaccio"
                command: |
                  cd << parameters.path >>
                  npm i --registry << parameters.registry >>
      - unless:
          condition: << parameters.use_verdaccio >>
          steps:
            - run:
                name: "Install app via npm"
                command: |
                  cd << parameters.path >>
                  npm i
      - run:
          name: "Build test app"
          command: |
            npx rimraf node_modules
            cd << parameters.path >>
            npm run test
          no_output_timeout: "30s"

  tacho_benchmark_prep:
    executor: docker_circleci_bench
    steps:
      - checkout
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          # build-true = build + generate native modules
          key: cache-{{ .Revision }}-build-true
      - run:
          name: "bench prep dep"
          working_directory: "benchmarks/latest"
          command: npm i
      - run:
          name: "bench prep build"
          working_directory: "benchmarks"
          command: npm run build
      - save_cache:
          key: cache-{{ .Revision }}-benchmark-app
          paths:
            - benchmarks/latest/dist/app.latest.js
            - benchmarks/latest/dist/app-big-template.latest.js
            - benchmarks/local/dist/app.local.js
            - benchmarks/local/dist/app-big-template.local.js

  tacho_benchmark:
    executor: docker_circleci_bench
    parameters:
      command:
        type: string
    steps:
      - checkout
      - browser-tools/install-chrome
      - browser-tools/install-chromedriver
      - restore_cache:
          name: "Restore dependencies"
          key: cache-{{ checksum "package-lock.json" }}-install
      - restore_cache:
          name: "Restore build artifacts"
          # build-true = build + generate native modules
          key: cache-{{ .Revision }}-build-true
      - restore_cache:
          name: "Restore benchmark artifacts"
          key: cache-{{ .Revision }}-benchmark-app
      - run:
          name: "benchmark: <<parameters.command>>"
          command: <<parameters.command>>
          working_directory: "benchmarks"
          no_output_timeout: "30s"

  # on branches that only touches doc
  # there's no need to run the workflow
  check_doc_abort:
    executor: docker_circleci
    environment:
      COMMIT_RANGE: << pipeline.git.base_revision >>..<<pipeline.git.revision>>
    steps:
      - checkout
      - run: |
          # Extract commit range (or single commit)
          echo "commit range from CircleCI: ${COMMIT_RANGE}"

          if [[ -n ${CIRCLE_PR_NUMBER} ]]; then
            curl -L "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64" \
              -o jq
            chmod +x jq
            url="https://api.github.com/repos/org/repo/pulls/$CIRCLE_PR_NUMBER?access_token=$GITHUB_TOKEN"
            TARGET_BRANCH=$(curl "$url" | ./jq '.base.ref' | tr -d '"')
            echo "Target branch: $TARGET_BRANCH"
            COMMIT_RANGE=$(echo "$CIRCLE_SHA1..$TARGET_BRANCH")
          fi

          echo "Normalized commit range: $COMMIT_RANGE"

          echo "File changed count: $(git diff --name-only $COMMIT_RANGE | grep -v '*' -c)"
          echo "Non doc file changes: $(git diff --name-only $COMMIT_RANGE | grep -v '^doc' -c)"

          if [[ $(git diff --name-only $COMMIT_RANGE | grep -v '*' -c) -gt 0 ]] && [[ $(git diff --name-only $COMMIT_RANGE | grep -v '^doc' -c) -eq 0 ]]; then
            echo "There is only doc work, cancelling workflow $CIRCLE_WORKFLOW_ID ..."
            curl --request POST \
              --url https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/cancel?circle-token=$CIRCLE_API_TOKEN

          else
            echo "There are more than doc changes, running workflow $CIRCLE_WORKFLOW_ID..."
          fi

# # # # # # # # # # # # # # # #
# - Workflows -
# # # # # # # # # # # # # # # #
workflows:
  # Runs build and tests
  # Triggered by push to master or topic branches
  build_test:
    jobs:
      - check_doc_abort:
          <<: *filter_ignore_develop_release
      - checkout_install_cache:
          <<: *filter_ignore_develop_release
          name: checkout_install
          requires:
              - check_doc_abort
      # - build_and_cache:
      #     <<: *filter_ignore_develop_release
      #     name: build_dev
      #     requires:
      #         - checkout_install
      - build_and_cache:
          <<: *filter_ignore_develop_release
          name: build_release
          command: npm run build:release
          release: true
          requires:
              - checkout_install
      - unit_test_esm:
          <<: *filter_ignore_develop_release
          name: test_chrome
          npm_command: "test-chrome"
          install_chrome: true
          requires:
            - build_release
      # - unit_test_esm:
      #     <<: *filter_ignore_develop_release
      #     name: test_firefox
      #     npm_command: "test-firefox"
      #     install_firefox: true
      #     coverage: false
      #     requires:
      #       - build_release
      - unit_test_esm_node:
          <<: *filter_ignore_develop_release
          name: test_node
          requires:
            - build_release
      - unit_test_cjs:
          <<: *filter_ignore_develop_release
          name: test_toolings
          npm_command: "test-node"
          requires:
            - build_release

      - lint_packages:
          <<: *filter_ignore_develop_release
          requires:
            - checkout_install

      - e2e_verdaccio:
          <<: *filter_ignore_develop_release
          name: e2e_verdaccio_parcel_ts
          path: "test/verdaccio-apps/parcel-conventions"
          requires:
            - build_release

      # no longer necessary since the changes related to fragment adoption has been reverted
      # though keeping it around for a bit longer in case there's a need again
      # - e2e_safari:
      #     <<: *filter_ignore_develop_release
      #     name: safari16_select
      #     path: "packages/__e2e__/select-safari16"
      #     requires:
      #       - check_doc_abort
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_hmr_vite
          path: "packages/__e2e__/hmr-vite"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_hmr_webpack
          path: "packages/__e2e__/hmr-webpack"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_router_lite
          path: "packages/__e2e__/router-lite"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_router
          path: "packages/__e2e__/router"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_i18n
          path: "packages/__e2e__/i18n"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_virtual_repeat
          path: "packages/__e2e__/ui-virtualization"
          requires:
            - build_release
      - tacho_benchmark_prep:
          <<: *filter_ignore_develop_release
          requires:
            - build_release
      - tacho_benchmark:
          <<: *filter_ignore_develop_release
          name: benchmark_startup
          command: npm run bench:startup10k
          requires:
            - tacho_benchmark_prep
      - tacho_benchmark:
          <<: *filter_ignore_develop_release
          name: benchmark_rerender
          command: npm run bench:rerender10k
          requires:
            - tacho_benchmark_prep
      - tacho_benchmark:
          <<: *filter_ignore_develop_release
          name: benchmark_rerender1k-big-template
          command: npm run bench:rerender1k-big
          requires:
            - tacho_benchmark_prep
      - tacho_benchmark:
          <<: *filter_ignore_develop_release
          name: benchmark_startup1k-big-template
          command: npm run bench:startup1k-big
          requires:
            - tacho_benchmark_prep
      - tacho_benchmark:
          <<: *filter_ignore_develop_release
          name: benchmark_update
          command: npm run bench:update1k
          requires:
            - tacho_benchmark_prep

      # - e2e_verdaccio:
      #     <<: *filter_ignore_develop_release
      #     name: webpack_vanilla_ts
      #     path: "examples/jit-webpack-vanilla-ts"
      #     requires:
      #       - build_release
      - merge_and_dist:
          <<: *filter_only_master
          name: merge_and_dist_master
          requires:
            - build_release
            - test_chrome
            # - test_firefox
            - test_node
            - test_toolings
            # - lint_packages
            - e2e_verdaccio_parcel_ts
            - e2e_hmr_vite
            - e2e_hmr_webpack
            - e2e_router_lite
            - e2e_router
            - e2e_i18n
          from: master
          to: develop
          channel: dev
          push: true
          merge_topic: false
      - merge_and_dist:
          <<: *filter_only_topic
          name: merge_and_dist_topic
          from: master
          to: develop
          channel: dev
          dist_file_name: merge_and_dist_topic
          requires:
            - build_release

      - request_publish_dev:
          <<: *filter_only_master
          type: approval
          no_output_timeout: 20m
      - publish_npm:
          <<: *filter_only_master
          name: publish_npm_dev
          channel: dev
          branch: develop
          swap: true
          requires:
            - request_publish_dev
            - merge_and_dist_master


  # Runs build and tests, and pushes the built artifacts to the release branch (which then triggers publish_latest)
  # Triggered by push to tag
  build_test_push_release:
    jobs:
      - checkout_install_cache:
          <<: *filter_only_tag
          name: checkout_install
      # - build_and_cache:
      #     <<: *filter_only_tag
      #     name: build_release
      #     requires:
      #       - checkout_install
      - build_and_cache:
          <<: *filter_only_tag
          name: build_release
          command: npm run build:release
          release: true
          requires:
            - checkout_install
      - unit_test_esm:
          <<: *filter_only_tag
          name: test_chrome
          npm_command: "test-chrome"
          install_chrome: true
          requires:
            - build_release
      # - unit_test_esm:
      #     <<: *filter_only_tag
      #     name: test_firefox
      #     npm_command: "test-firefox"
      #     install_firefox: true
      #     coverage: false
      #     requires:
      #       - build_release
      - unit_test_esm_node:
          <<: *filter_only_tag
          name: test_node
          requires:
            - build_release
      - unit_test_cjs:
          <<: *filter_only_tag
          name: test_toolings
          npm_command: "test-node"
          requires:
            - build_release

      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_hmr_vite
          path: "packages/__e2e__/hmr-vite"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_hmr_webpack
          path: "packages/__e2e__/hmr-webpack"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_router_lite
          path: "packages/__e2e__/router-lite"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_router
          path: "packages/__e2e__/router"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_i18n
          path: "packages/__e2e__/i18n"
          requires:
            - build_release
      - e2e_test:
          <<: *filter_ignore_develop_release
          name: e2e_virtual_repeat
          path: "packages/__e2e__/ui-virtualization"
          requires:
            - build_release

      # - lint_packages:
      #     <<: *filter_only_tag
      #     requires:
      #       - checkout_install

      - merge_and_dist:
          <<: *filter_only_tag
          requires:
            # build release to get the build artifacts
            - build_release
            # and the rest for testings
            - test_chrome
            # - test_firefox
            - test_node
            - test_toolings
            - e2e_hmr_vite
            - e2e_hmr_webpack
            - e2e_router_lite
            - e2e_router
            - e2e_i18n
          from: $CIRCLE_TAG
          to: release
          channel: latest
          push: true
          merge_topic: false
          bump_version: false

  # Asks for manual approval and then publishes from the release branch to npm@latest
  # Triggered by push to release branch
  publish_latest:
    jobs:
      # artifacts are already prepared and committed by the tag workflow, so only approval + publish remains
      - request_publish_latest:
          <<: *filter_only_release
          type: approval
      - publish_npm:
          <<: *filter_only_release
          name: publish_npm_latest
          channel: latest
          branch: release
          requires:
            - request_publish_latest