<commit_before>version: 2

# Adapted from https://github.com/circleci/circleci-docs/blob/master/.circleci/config.yml
# Syntax: https://blog.daemonl.com/2016/02/yaml.html
references:
  js_deps_paths: &js_deps_paths
  - node_modules/
  - packages/patternfly-4/node_modules/
  - packages/patternfly-4/gatsby-theme-patternfly-org/node_modules/
  - packages/patternfly-4/node_modules/
  - packages/patternfly-4/patternfly-next/node_modules/
  - packages/patternfly-4/patternfly-react/packages/patternfly-4/react-docs/node_modules/
  v3_js_deps_paths: &v3_js_deps_paths
  - packages/patternfly-3/node_modules
  v3_ruby_deps_paths: &v3_ruby_deps_paths
  - packages/patternfly-3/.bundle
  next_build_cache_paths: &next_build_cache_paths
  - packages/patternfly-4/patternfly-next/.cache
  - packages/patternfly-4/patternfly-next/public
  react_build_cache_paths: &react_build_cache_paths
  - packages/patternfly-4/patternfly-react/packages/patternfly-4/react-docs/.cache
  - packages/patternfly-4/patternfly-react/packages/patternfly-4/react-docs/public
  org_build_cache_paths: &org_build_cache_paths
  - packages/patternfly-4/.cache
  - packages/patternfly-4/public
  # Excluded: react-docs/plugins
  js_deps_cache_key: &js_deps_cache_key
    js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  js_deps_cache_key_check: &js_deps_cache_key_check
    js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}-check
  v3_js_deps_cache_key: &v3_js_deps_cache_key
    v3-js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "packages/patternfly-3/yarn.lock"}}
  v3_ruby_deps_cache_key: &v3_ruby_deps_cache_key
    v3-ruby-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "packages/patternfly-3/Gemfile.lock"}}
  next_build_cache_key: &next_build_cache_key
    next-build-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  react_build_cache_key: &react_build_cache_key
    react-build-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  org_build_cache_key: &org_build_cache_key
    org-build-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  attach_workspace: &attach_workspace
    attach_workspace:
      at: ~/project
workflows:
  version: 2
  install_build_deploy:
    jobs:
    - install
    - build_next:
        requires:
        - install
    - build_react:
        requires:
        - install
    - build_org:
        requires:
        - install
    - build_v3:
        requires:
        - install
    - upload_previews:
        requires:
        - build_react
        - build_next
        - build_org
        - build_v3
    # - test_org_a11y:
    #     requires:
    #     - build_org
    - deploy:
        requires:
        - build_react
        - build_next
        - build_org
        - build_v3
        filters:
          branches:
            only: master
jobs:
  install:
    docker:
    - image: circleci/node:12
    steps:
    - checkout
    - run:
        name: Pull Submodules
        command: |
          git submodule init
          git submodule update
    - persist_to_workspace:
        root: ~/project
        paths: 
        - "*"
    - restore_cache:
        keys:
        - *js_deps_cache_key_check
    - run:
        name: Conditional install
        command: if [ ! -f cached ]; then yarn install --frozen-lockfile && touch cached; fi
    - save_cache:
        paths: cached
        key: *js_deps_cache_key_check
    - save_cache:
        paths: *js_deps_paths
        key: *js_deps_cache_key
  build_next:
    docker:
    - image: circleci/node:12
    steps:
    - *attach_workspace
    - restore_cache:
        keys:
        - *js_deps_cache_key
    - restore_cache:
        keys:
        - *next_build_cache_key
    - run:
        name: Build patternfly-next docs
        command: yarn build:next
    - save_cache:
        paths: *next_build_cache_paths
        key: *next_build_cache_key
    - persist_to_workspace:
        root: ~/project
        paths: 
        - build
  build_react:
    docker:
    - image: circleci/node:12
    resource_class: medium
    steps:
    - *attach_workspace
    - restore_cache:
        keys:
        - *js_deps_cache_key
    - restore_cache:
        keys:
        - *react_build_cache_key
    - run:
        name: Build patternfly-react docs
        command: yarn build:react
    - save_cache:
        paths: *react_build_cache_paths
        key: *react_build_cache_key
    - persist_to_workspace:
        root: ~/project
        paths: 
        - build
  build_v3:
    docker:
    - image: circleci/ruby:latest-node
    steps:
    - *attach_workspace
    - restore_cache:
        keys:
        - *v3_js_deps_cache_key
    - restore_cache:
        keys:
        - *v3_ruby_deps_cache_key
    - run:
        name: Install v3 deps
        command: |
          cd packages/patternfly-3
          bundle install
          yarn install
    - save_cache:
        paths: *v3_ruby_deps_paths
        key: *v3_ruby_deps_cache_key
    - save_cache:
        paths: *v3_js_deps_paths
        key: *v3_js_deps_cache_key
    - run:
        name: Build v3 docs
        command: yarn build:org:v3
    - persist_to_workspace:
        root: ~/project
        paths: 
        - build
  build_org:
    docker:
    - image: circleci/node:12
    resource_class: medium
    steps:
    - *attach_workspace
    - restore_cache:<commit_msg>use large for build_org to prevent timeout<commit_after>version: 2

# Adapted from https://github.com/circleci/circleci-docs/blob/master/.circleci/config.yml
# Syntax: https://blog.daemonl.com/2016/02/yaml.html
references:
  js_deps_paths: &js_deps_paths
  - node_modules/
  - packages/patternfly-4/node_modules/
  - packages/patternfly-4/gatsby-theme-patternfly-org/node_modules/
  - packages/patternfly-4/node_modules/
  - packages/patternfly-4/patternfly-next/node_modules/
  - packages/patternfly-4/patternfly-react/packages/patternfly-4/react-docs/node_modules/
  v3_js_deps_paths: &v3_js_deps_paths
  - packages/patternfly-3/node_modules
  v3_ruby_deps_paths: &v3_ruby_deps_paths
  - packages/patternfly-3/.bundle
  next_build_cache_paths: &next_build_cache_paths
  - packages/patternfly-4/patternfly-next/.cache
  - packages/patternfly-4/patternfly-next/public
  react_build_cache_paths: &react_build_cache_paths
  - packages/patternfly-4/patternfly-react/packages/patternfly-4/react-docs/.cache
  - packages/patternfly-4/patternfly-react/packages/patternfly-4/react-docs/public
  org_build_cache_paths: &org_build_cache_paths
  - packages/patternfly-4/.cache
  - packages/patternfly-4/public
  # Excluded: react-docs/plugins
  js_deps_cache_key: &js_deps_cache_key
    js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  js_deps_cache_key_check: &js_deps_cache_key_check
    js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}-check
  v3_js_deps_cache_key: &v3_js_deps_cache_key
    v3-js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "packages/patternfly-3/yarn.lock"}}
  v3_ruby_deps_cache_key: &v3_ruby_deps_cache_key
    v3-ruby-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "packages/patternfly-3/Gemfile.lock"}}
  next_build_cache_key: &next_build_cache_key
    next-build-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  react_build_cache_key: &react_build_cache_key
    react-build-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  org_build_cache_key: &org_build_cache_key
    org-build-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}}
  attach_workspace: &attach_workspace
    attach_workspace:
      at: ~/project
workflows:
  version: 2
  install_build_deploy:
    jobs:
    - install
    - build_next:
        requires:
        - install
    - build_react:
        requires:
        - install
    - build_org:
        requires:
        - install
    - build_v3:
        requires:
        - install
    - upload_previews:
        requires:
        - build_react
        - build_next
        - build_org
        - build_v3
    # - test_org_a11y:
    #     requires:
    #     - build_org
    - deploy:
        requires:
        - build_react
        - build_next
        - build_org
        - build_v3
        filters:
          branches:
            only: master
jobs:
  install:
    docker:
    - image: circleci/node:12
    steps:
    - checkout
    - run:
        name: Pull Submodules
        command: |
          git submodule init
          git submodule update
    - persist_to_workspace:
        root: ~/project
        paths: 
        - "*"
    - restore_cache:
        keys:
        - *js_deps_cache_key_check
    - run:
        name: Conditional install
        command: if [ ! -f cached ]; then yarn install --frozen-lockfile && touch cached; fi
    - save_cache:
        paths: cached
        key: *js_deps_cache_key_check
    - save_cache:
        paths: *js_deps_paths
        key: *js_deps_cache_key
  build_next:
    docker:
    - image: circleci/node:12
    steps:
    - *attach_workspace
    - restore_cache:
        keys:
        - *js_deps_cache_key
    - restore_cache:
        keys:
        - *next_build_cache_key
    - run:
        name: Build patternfly-next docs
        command: yarn build:next
    - save_cache:
        paths: *next_build_cache_paths
        key: *next_build_cache_key
    - persist_to_workspace:
        root: ~/project
        paths: 
        - build
  build_react:
    docker:
    - image: circleci/node:12
    resource_class: medium
    steps:
    - *attach_workspace
    - restore_cache:
        keys:
        - *js_deps_cache_key
    - restore_cache:
        keys:
        - *react_build_cache_key
    - run:
        name: Build patternfly-react docs
        command: yarn build:react
    - save_cache:
        paths: *react_build_cache_paths
        key: *react_build_cache_key
    - persist_to_workspace:
        root: ~/project
        paths: 
        - build
  build_v3:
    docker:
    - image: circleci/ruby:latest-node
    steps:
    - *attach_workspace
    - restore_cache:
        keys:
        - *v3_js_deps_cache_key
    - restore_cache:
        keys:
        - *v3_ruby_deps_cache_key
    - run:
        name: Install v3 deps
        command: |
          cd packages/patternfly-3
          bundle install
          yarn install
    - save_cache:
        paths: *v3_ruby_deps_paths
        key: *v3_ruby_deps_cache_key
    - save_cache:
        paths: *v3_js_deps_paths
        key: *v3_js_deps_cache_key
    - run:
        name: Build v3 docs
        command: yarn build:org:v3
    - persist_to_workspace:
        root: ~/project
        paths: 
        - build
  build_org:
    docker:
    - image: circleci/node:12
    resource_class: large
    steps:
    - *attach_workspace
    - restore_cache:
{'fraction_non_alphanumeric': 0.09799136474563544, 'fraction_numerical': 0.011263375258119017, 'mean_word_length': 2.336987159411212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '616331', 'n_tokens_mistral': 3773, 'n_tokens_neox': 3666, 'n_words': 553}