<commit_before>name: CI

on:
  push:
    branches:
      - main
  pull_request:

env:
  BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
  BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
  NX_CLOUD_DISTRIBUTED_EXECUTION: true

jobs:
  install-deps:
    name: Install and cache dependencies
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Cache node modules
        id: cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: npm install
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci
      - name: Start Nx Cloud CI run
        run: npx nx-cloud start-ci-run

  agents:
    name: Bootup Nx Cloud agent
    runs-on: ubuntu-latest
    needs: install-deps
    strategy:
      matrix:
        agent: [1, 2, 3]
    steps:
      - uses: actions/checkout@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Start Nx Agent ${{ matrix.agent }}
        run: npx nx-cloud start-agent

  lint:
    name: Lint
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Check library dependencies
        run: npx skyux-dev check-lib-dependencies
      - name: Check library missing peers
        run: npx skyux-dev check-lib-missing-peers
      - name: Check library resources
        run: npx skyux-dev check-lib-resources
      - name: Check code formatting
        run: npx prettier --check .
      - name: Run lint
        run: npx nx affected:lint --quiet --silent --parallel --maxParallel=5 --exclude=ci

  build:
    name: Build
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Build
        run: npx nx affected --target=build --parallel --maxParallel=5 --exclude=ci

  coverage:
    name: Code coverage
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Code coverage
        run: |
          npx skyux-dev test-affected

  browserstack:
    name: Cross-browser testing
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Cross-browser tests
        run: |
          npx skyux-dev test-affected --codeCoverage=false --karmaConfig=config/karma/karma.ci.conf.js --onlyComponents

  stop-agents:
    name: Stop Nx Cloud agents
    runs-on: ubuntu-latest
    if: always()
    needs: [lint, build, coverage, browserstack]
    steps:<commit_msg>ci: create packages distribution for push events (#225) (#229)<commit_after>name: CI

on:
  push:
    branches:
      - main
  pull_request:

env:
  BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
  BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
  NX_CLOUD_DISTRIBUTED_EXECUTION: true

jobs:
  install-deps:
    name: Install and cache dependencies
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Cache node modules
        id: cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: npm install
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci
      - name: Start Nx Cloud CI run
        run: npx nx-cloud start-ci-run

  agents:
    name: Bootup Nx Cloud agent
    runs-on: ubuntu-latest
    needs: install-deps
    strategy:
      matrix:
        agent: [1, 2, 3]
    steps:
      - uses: actions/checkout@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Start Nx Agent ${{ matrix.agent }}
        run: npx nx-cloud start-agent

  lint:
    name: Lint
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Check library dependencies
        run: npx skyux-dev check-lib-dependencies
      - name: Check library missing peers
        run: npx skyux-dev check-lib-missing-peers
      - name: Check library resources
        run: npx skyux-dev check-lib-resources
      - name: Check code formatting
        run: npx prettier --check .
      - name: Run lint
        run: npx nx affected:lint --quiet --silent --parallel --maxParallel=5 --exclude=ci

  build:
    name: Build
    needs: install-deps
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'pull_request' }}
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Build
        run: npx nx affected --target=build --parallel --maxParallel=5 --exclude=ci

  build-dist:
    name: Build packages distribution
    needs: install-deps
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' }}
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Build packages dist
        run: npx skyux-dev create-packages-dist

  coverage:
    name: Code coverage
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Code coverage
        run: |
          npx skyux-dev test-affected

  browserstack:
    name: Cross-browser testing
    needs: install-deps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # We need to fetch all branches and commits so that Nx affected has a base to compare against.
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: '14'
      # Rebase must happen before installing dependencies.
      - name: Rebase current branch
        run: node ./scripts/rebase-pr.js
      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v2
      - name: Retrieve node_modules cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - name: Cross-browser tests
        run: |
          npx skyux-dev test-affected --codeCoverage=false --karmaConfig=config/karma/karma.ci.conf.js --onlyComponents

  stop-agents:
    name: Stop Nx Cloud agents
    runs-on: ubuntu-latest
    if: always()
    needs: [lint, build, build-dist, coverage, browserstack]
    steps:
{'fraction_non_alphanumeric': 0.0924627166465135, 'fraction_numerical': 0.007577589681580008, 'mean_word_length': 2.050405704450455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1968661', 'n_tokens_mistral': 3806, 'n_tokens_neox': 3667, 'n_words': 1141}