<commit_before># DOCS: https://help.github.com/en/articles/workflow-syntax-for-github-actions

name: meli ci
on: [pull_request, push]

jobs:

  build:
    name: build
    runs-on: ubuntu-18.04
    timeout-minutes: 5
    steps:
      - name: Set up Go 1.13
        uses: actions/setup-go@v1
        with:
          go-version: 1.13
        id: go

      - name: Check out code into the Go module directory
        uses: actions/checkout@v1

      - name: install apt and pip deps
        env:
          someEnvVarName: someEnvVarValue
        run: |
          pwd; ls -lsha
          sudo apt-get -y update
          sudo apt -y install \
                      curl \
                      git \
                      python \
                      python-pip \
                      software-properties-common \
                      build-essential \
                      apt-transport-https \
                      ca-certificates
          pip install -U docker-compose

      - name: check if changes have release notes
        if: github.ref != 'refs/heads/master'
        run: |
          ChangedFiles=`git diff --name-only origin/master`
          echo $ChangedFiles
          case "$ChangedFiles" in
              *RELEASE_NOTES.*)
                  printf '\n Thanks, your commits include update to release notes. \n';;
              *)
                  printf '\n You should add release notes to .github/RELEASE_NOTES.md \n' && exit 77;;
          esac
      
      - name: install Docker
        run: |
          wget --directory-prefix=/tmp https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz
          tar -xz -C /tmp -f /tmp/docker-$DOCKER_VERSION.tgz
          chmod +x /tmp/docker/docker
          sudo mv /tmp/docker/* /usr/bin
          docker version
        env:
          DOCKER_VERSION: '18.09.6'

      - name: run meli
        run: |
          go build --race -o meli cli/cli.go
          ./meli -v
          ./meli -up -d -f testdata/docker-compose.yml
          num_containers=$(docker ps -q | wc -l)
          echo "number of containers are; $num_containers"
          if [ "$num_containers" != "12" ]; then
              echo "wanted 12 containers, got $num_containers" && exit 500
          fi

      - name: check that docker linking works
        run: |
          docker exec backup ping -w3 redis
          # TODO: this works locally but not in github ci
          #docker exec backup ping -w3 eminem.com<commit_msg>update ci<commit_after># DOCS: https://help.github.com/en/articles/workflow-syntax-for-github-actions

name: meli ci
on: [pull_request, push]

jobs:
  build:

    name: build
    timeout-minutes: 5
    strategy:
      matrix:
        go-version: [1.13]
        platform: [ubuntu-18.04, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Set up Go 1.13
        uses: actions/setup-go@v1
        with:
          go-version: ${{ matrix.go-version }}

      - name: Check out code into the Go module directory
        uses: actions/checkout@v1

      - name: install apt and pip deps
        env:
          someEnvVarName: someEnvVarValue
        run: |
          pwd; ls -lsha
          sudo apt-get -y update
          sudo apt -y install \
                      curl \
                      git \
                      python \
                      python-pip \
                      software-properties-common \
                      build-essential \
                      apt-transport-https \
                      ca-certificates
          pip install -U docker-compose

      - name: check if changes have release notes
        if: github.ref != 'refs/heads/master'
        env:
          GIT_BRANCH: ${{ github.ref }}
        run: |
          if [ "$GIT_BRANCH" == "master" ]
          then
              printf "\n $GIT_BRANCH branch, ignoring check for relese notes \n"
          elif [ "$GIT_BRANCH" == *"refs/tags/"* ]
          then
              printf "\n $GIT_BRANCH branch, ignoring check for relese notes \n"
          else
              ChangedFiles=`git diff --name-only origin/master`
              echo $ChangedFiles
              case "$ChangedFiles" in
                *RELEASE_NOTES.*)
                    printf "\n Thanks, your commits include update to release notes. \n";;
                *)
                    printf '\n You should add release notes to .github/RELEASE_NOTES.md \n' && exit 77;;
              esac
          fi

      - name: install Docker
        run: |
          wget --directory-prefix=/tmp https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz
          tar -xz -C /tmp -f /tmp/docker-$DOCKER_VERSION.tgz
          chmod +x /tmp/docker/docker
          sudo mv /tmp/docker/* /usr/bin
          docker version
        env:
          DOCKER_VERSION: '18.09.6'

      - name: run meli
        run: |
          go build --race -o meli cli/cli.go
          ./meli -v
          ./meli -up -d -f testdata/docker-compose.yml
          num_containers=$(docker ps -q | wc -l)
          echo "number of containers are; $num_containers"
          if [ "$num_containers" != "12" ]; then
              echo "wanted 12 containers, got $num_containers" && exit 500
          fi

      - name: check that docker linking works
        run: |
          docker exec backup ping -w3 redis
          # TODO: this works locally but not in github ci
          #docker exec backup ping -w3 eminem.com
{'fraction_non_alphanumeric': 0.0959079283887468, 'fraction_numerical': 0.01205699671172817, 'mean_word_length': 1.3825065274151436, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3793411', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1527, 'n_words': 465}