<commit_before>name: Test and Deploy
on:
  push:
    branches: [ '*' ]
    tags: [ '*' ]
  pull_request:
    branches: [ main ]
  schedule:
    # Run automatically at 8AM PST Monday-Friday
    - cron: '0 15 * * 1-5'
  workflow_dispatch:

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    timeout-minutes: 20
    strategy:
      matrix:
        go: [ '1.11', '1.12', '1.13', '1.14', '1.15', '1.16' ]
    steps:
      - name: Checkout smtpapi-go
        uses: actions/checkout@v2

      - name: Setup Go environment
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}

      - name: Set Go env vars
        run: |
          echo "GOPATH=$HOME" >> $GITHUB_ENV
          echo "GOBIN=$HOME/bin" >> $GITHUB_ENV
          echo "GO111MODULE=off" >> $GITHUB_ENV

      - name: Run Tests
        run: make test
  
  deploy:
    name: Deploy
    if: success() && github.ref_type == 'tag'
    needs: [ test ]
    runs-on: ubuntu-latest
    steps:
      - name: Create GitHub Release
        uses: sendgrid/dx-automator/actions/release@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  notify-on-failure:
    name: Slack notify on failure
    if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
    needs: [ test, deploy ]
    runs-on: ubuntu-latest
    steps:
      - uses: rtCamp/action-slack-notify@v2
        env:
          SLACK_COLOR: 'failure'
          SLACK_ICON_EMOJI: ':github:'
          SLACK_MESSAGE: ${{ format('Tests *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
          SLACK_TITLE: Action Failure - ${{ github.repository }}
          SLACK_USERNAME: GitHub Actions
          SLACK_MSG_AUTHOR: twilio-dx
          SLACK_FOOTER: Posted automatically using GitHub Actions
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          MSG_MINIMAL: true<commit_msg>chore: make Slack message consistent across all repos<commit_after>name: Test and Deploy
on:
  push:
    branches: [ '*' ]
    tags: [ '*' ]
  pull_request:
    branches: [ main ]
  schedule:
    # Run automatically at 8AM PST Monday-Friday
    - cron: '0 15 * * 1-5'
  workflow_dispatch:

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    timeout-minutes: 20
    strategy:
      matrix:
        go: [ '1.11', '1.12', '1.13', '1.14', '1.15', '1.16' ]
    steps:
      - name: Checkout smtpapi-go
        uses: actions/checkout@v2

      - name: Setup Go environment
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}

      - name: Set Go env vars
        run: |
          echo "GOPATH=$HOME" >> $GITHUB_ENV
          echo "GOBIN=$HOME/bin" >> $GITHUB_ENV
          echo "GO111MODULE=off" >> $GITHUB_ENV

      - name: Run Tests
        run: make test
  
  deploy:
    name: Deploy
    if: success() && github.ref_type == 'tag'
    needs: [ test ]
    runs-on: ubuntu-latest
    steps:
      - name: Create GitHub Release
        uses: sendgrid/dx-automator/actions/release@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  notify-on-failure:
    name: Slack notify on failure
    if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
    needs: [ test, deploy ]
    runs-on: ubuntu-latest
    steps:
      - uses: rtCamp/action-slack-notify@v2
        env:
          SLACK_COLOR: 'failure'
          SLACK_ICON_EMOJI: ':github:'
          SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
          SLACK_TITLE: Action Failure - ${{ github.repository }}
          SLACK_USERNAME: GitHub Actions
          SLACK_MSG_AUTHOR: twilio-dx
          SLACK_FOOTER: Posted automatically using GitHub Actions
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          MSG_MINIMAL: true
{'fraction_non_alphanumeric': 0.13437268002969563, 'fraction_numerical': 0.018312298935906954, 'mean_word_length': 2.259677419354839, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5698808', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1368, 'n_words': 314}