<commit_before>name: CI
on:
  push:
    branches:
      - master
  pull_request:
env:
  HOMEBREW_DEVELOPER: 1
  HOMEBREW_NO_AUTO_UPDATE: 1
jobs:
  syntax:
    if: github.repository == 'Homebrew/brew'
    runs-on: ubuntu-latest
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Cache Bundler RubyGems
        uses: actions/cache@v1
        with:
          path: ${{ steps.set-up-homebrew.outputs.gems-path }}
          key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
          restore-keys: ${{ runner.os }}-rubygems-

      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - run: brew style --display-cop-names

      - run: brew man --fail-if-changed

      - run: brew typecheck

      - name: Run vale for docs linting
        run: |
          brew install vale
          vale docs/

      - name: Lint Dockerfile
        run: |
          brew install hadolint
          hadolint Dockerfile

  tap-syntax:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: tap syntax (Linux)
            os: ubuntu-latest
            core-tap: "linuxbrew-core"
          - name: tap syntax (macOS)
            os: macos-11.0
            core-tap: "homebrew-core"
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - run: brew test-bot --only-cleanup-before

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - run: brew config

      - name: Cache Bundler RubyGems
        uses: actions/cache@v1
        with:
          path: ${{ steps.set-up-homebrew.outputs.gems-path }}
          key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
          restore-keys: ${{ runner.os }}-rubygems-

      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - run: brew doctor

      - name: Run brew update-tests
        if: github.event_name == 'pull_request'
        run: |
          brew update-test
          brew update-test --to-tag
          brew update-test --commit=HEAD

      - name: Set up all Homebrew taps
        if: runner.os == 'macOS'
        run: |
          brew tap homebrew/cask
          brew tap homebrew/cask-drivers
          brew tap homebrew/cask-fonts
          brew tap homebrew/cask-versions
          brew update-reset Library/Taps/homebrew/homebrew-bundle \
                            Library/Taps/homebrew/homebrew-cask \
                            Library/Taps/homebrew/homebrew-cask-versions \
                            Library/Taps/homebrew/homebrew-services

      - name: Run brew readall on all taps
        run: brew readall --aliases

      - name: Run brew style on ${{ matrix.core-tap }}
        run: brew style --display-cop-names homebrew/core

      - name: Run brew style on official taps
        if: runner.os == 'macOS'
        run: |
          brew style --display-cop-names homebrew/bundle \
                                         homebrew/services \
                                         homebrew/test-bot

      - name: Run brew style on cask taps
        if: runner.os == 'macOS'
        run: |
          brew style --display-cop-names homebrew/cask \
                                         homebrew/cask-drivers \
                                         homebrew/cask-fonts \
                                         homebrew/cask-versions

      - name: Run brew audit --skip-style on all taps
        run: brew audit --skip-style

  vendored-gems:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: vendored gems (Linux)
            os: ubuntu-latest
            core-tap: "linuxbrew-core"
          - name: vendored gems (macOS)
            os: macos-11.0
            core-tap: "homebrew-core"
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - name: Configure Git user
        uses: Homebrew/actions/git-user-config@master
        with:
          username: BrewTestBot

      # Can't cache this because we need to check that it doesn't fail the
      # "uncommitted RubyGems" step with a cold cache.
      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - name: Check for uncommitted RubyGems
        run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby

  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Build Docker image
        run: docker build -t brew --build-arg=version=16.04 .

      - name: Deploy the Docker image to GitHub Packages and Docker Hub
        if: github.ref == 'refs/heads/master'
        run: |
          echo ${{secrets.HOMEBREW_GITHUB_PACKAGES_API_TOKEN}} | \
            docker login ghcr.io -u BrewTestBot --password-stdin
          docker tag brew "ghcr.io/homebrew/ubuntu16.04:master"
          docker push "ghcr.io/homebrew/ubuntu16.04:master"
          echo ${{secrets.DOCKER_TOKEN}} | \
            docker login -u brewtestbot --password-stdin
          docker tag brew "homebrew/ubuntu16.04:master"
          docker push "homebrew/ubuntu16.04:master"

  tests:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: 'tests (no-compatibility mode)'
            os: ubuntu-latest
            test-flags: --no-compat --online --coverage
          - name: 'tests (generic OS)'
            os: ubuntu-latest
            test-flags: --generic --online --coverage
          - name: tests (Linux)
            os: ubuntu-latest
            test-flags: --online --coverage
          - name: tests (macOS)
            os: macos-11.0
            test-flags: --online --coverage
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - name: Install brew tests dependencies
        if: runner.os == 'macOS'
        run: |
          brew install subversion
          Library/Homebrew/shims/scm/svn --homebrew=print-path
          which svn
          which svnadmin

      - name: Cache Bundler RubyGems
        uses: actions/cache@v1
        with:
          path: ${{ steps.set-up-homebrew.outputs.gems-path }}
          key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
          restore-keys: ${{ runner.os }}-rubygems-

      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - name: Run brew tests
        run: |
          if ${{ runner.os == 'Linux' }}; then
            # brew tests doesn't like world writable directories
            sudo chmod -R g-w,o-w /home/linuxbrew/.linuxbrew/Homebrew
          fi

          if ${{ runner.os == 'macOS' }}; then
            # These cannot be queried at the macOS level on GitHub Actions.
            export HOMEBREW_LANGUAGES='en-GB'
          fi

          if ${{ contains(matrix.test-flags, '--coverage') }}; then
            # Set variables for coverage reporting.
            export HOMEBREW_CODECOV_TOKEN='3<PASSWORD>'
          fi

          brew tests ${{ matrix.test-flags }}
        env:
          HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  test-default-formula:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: test default formula (Linux)
            os: ubuntu-latest
          - name: test default formula (macOS)
            os: macos-11.0
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - run: brew test-bot --only-cleanup-before

      - run: brew test-bot --only-formulae --test-default-formula

  conclusion:
    needs:
      - syntax
      - tap-syntax
      - vendored-gems
      - tests
      - docker
      - test-default-formula
    runs-on: ubuntu-latest
    if: always()
    steps:
      - run: >
          ${{
            needs.syntax.result == 'success' &&
            needs.tap-syntax.result == 'success' &&
            needs.vendored-gems.result == 'success' &&
            needs.docker.result == 'success' &&
            needs.tests.result == 'success' &&
            needs.test-default-formula.result == 'success'
          }}
<commit_msg>workflows/tests: style tweaks.<commit_after>name: CI
on:
  push:
    branches:
      - master
  pull_request:
env:
  HOMEBREW_DEVELOPER: 1
  HOMEBREW_NO_AUTO_UPDATE: 1
jobs:
  syntax:
    if: github.repository == 'Homebrew/brew'
    runs-on: ubuntu-latest
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Cache Bundler RubyGems
        uses: actions/cache@v1
        with:
          path: ${{ steps.set-up-homebrew.outputs.gems-path }}
          key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
          restore-keys: ${{ runner.os }}-rubygems-

      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - run: brew style --display-cop-names

      - run: brew man --fail-if-changed

      - run: brew typecheck

      - name: Run vale for docs linting
        run: |
          brew install vale
          vale docs/

      - name: Lint Dockerfile
        run: |
          brew install hadolint
          hadolint Dockerfile

  tap-syntax:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: tap syntax (Linux)
            os: ubuntu-latest
            core-tap: "linuxbrew-core"
          - name: tap syntax (macOS)
            os: macos-11.0
            core-tap: "homebrew-core"
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - run: brew test-bot --only-cleanup-before

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - run: brew config

      - name: Cache Bundler RubyGems
        uses: actions/cache@v1
        with:
          path: ${{ steps.set-up-homebrew.outputs.gems-path }}
          key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
          restore-keys: ${{ runner.os }}-rubygems-

      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - run: brew doctor

      - name: Run brew update-tests
        if: github.event_name == 'pull_request'
        run: |
          brew update-test
          brew update-test --to-tag
          brew update-test --commit=HEAD

      - name: Set up all Homebrew taps
        if: runner.os == 'macOS'
        run: |
          brew tap homebrew/cask
          brew tap homebrew/cask-drivers
          brew tap homebrew/cask-fonts
          brew tap homebrew/cask-versions
          brew update-reset Library/Taps/homebrew/homebrew-bundle \
                            Library/Taps/homebrew/homebrew-cask \
                            Library/Taps/homebrew/homebrew-cask-versions \
                            Library/Taps/homebrew/homebrew-services

      - name: Run brew readall on all taps
        run: brew readall --aliases

      - name: Run brew style on ${{ matrix.core-tap }}
        run: brew style --display-cop-names homebrew/core

      - name: Run brew style on official taps
        if: runner.os == 'macOS'
        run: |
          brew style --display-cop-names homebrew/bundle \
                                         homebrew/services \
                                         homebrew/test-bot

      - name: Run brew style on cask taps
        if: runner.os == 'macOS'
        run: |
          brew style --display-cop-names homebrew/cask \
                                         homebrew/cask-drivers \
                                         homebrew/cask-fonts \
                                         homebrew/cask-versions

      - name: Run brew audit --skip-style on all taps
        run: brew audit --skip-style

  vendored-gems:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: vendored gems (Linux)
            os: ubuntu-latest
            core-tap: "linuxbrew-core"
          - name: vendored gems (macOS)
            os: macos-11.0
            core-tap: "homebrew-core"
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - name: Configure Git user
        uses: Homebrew/actions/git-user-config@master
        with:
          username: BrewTestBot

      # Can't cache this because we need to check that it doesn't fail the
      # "uncommitted RubyGems" step with a cold cache.
      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - name: Check for uncommitted RubyGems
        run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby

  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Build Docker image
        run: docker build -t brew --build-arg=version=16.04 .

      - name: Deploy the Docker image to GitHub Packages and Docker Hub
        if: github.ref == 'refs/heads/master'
        run: |
          echo ${{secrets.HOMEBREW_GITHUB_PACKAGES_API_TOKEN}} | \
            docker login ghcr.io -u BrewTestBot --password-stdin
          docker tag brew "ghcr.io/homebrew/ubuntu16.04:master"
          docker push "ghcr.io/homebrew/ubuntu16.04:master"
          echo ${{secrets.DOCKER_TOKEN}} | \
            docker login -u brewtestbot --password-stdin
          docker tag brew "homebrew/ubuntu16.04:master"
          docker push "homebrew/ubuntu16.04:master"

  tests:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: "tests (no-compatibility mode)"
            os: ubuntu-latest
            test-flags: --no-compat --online --coverage
          - name: "tests (generic OS)"
            os: ubuntu-latest
            test-flags: --generic --online --coverage
          - name: tests (Linux)
            os: ubuntu-latest
            test-flags: --online --coverage
          - name: tests (macOS)
            os: macos-11.0
            test-flags: --online --coverage
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - name: Install brew tests dependencies
        if: runner.os == 'macOS'
        run: |
          brew install subversion
          Library/Homebrew/shims/scm/svn --homebrew=print-path
          which svn
          which svnadmin

      - name: Cache Bundler RubyGems
        uses: actions/cache@v1
        with:
          path: ${{ steps.set-up-homebrew.outputs.gems-path }}
          key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
          restore-keys: ${{ runner.os }}-rubygems-

      - name: Install Bundler RubyGems
        run: brew install-bundler-gems

      - name: Run brew tests
        run: |
          if ${{ runner.os == 'Linux' }}; then
            # brew tests doesn't like world writable directories
            sudo chmod -R g-w,o-w /home/linuxbrew/.linuxbrew/Homebrew
          elif ${{ runner.os == 'macOS' }}; then
            # These cannot be queried at the macOS level on GitHub Actions.
            export HOMEBREW_LANGUAGES='en-GB'
          fi

          if ${{ contains(matrix.test-flags, '--coverage') }}; then
            # Set variables for coverage reporting.
            export HOMEBREW_CODECOV_TOKEN='3<PASSWORD>'
          fi

          brew tests ${{ matrix.test-flags }}
        env:
          HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  test-default-formula:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: test default formula (Linux)
            os: ubuntu-latest
          - name: test default formula (macOS)
            os: macos-11.0
    steps:
      - name: Set up Homebrew
        id: set-up-homebrew
        uses: Homebrew/actions/setup-homebrew@master

      - name: Set up Xcode
        if: matrix.os == 'macos-11.0'
        run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer

      - run: brew test-bot --only-cleanup-before

      - run: brew test-bot --only-formulae --test-default-formula

{'fraction_non_alphanumeric': 0.10843578267520254, 'fraction_numerical': 0.007025097728174041, 'mean_word_length': 1.6330548926014319, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1046201', 'n_tokens_mistral': 5568, 'n_tokens_neox': 5167, 'n_words': 1325}