<commit_before>---
name: Land-blocking Test

on:
  push:
    branches:
      - auto

jobs:
  build-and-run-cluster-test:
    name: Build images and run cluster test
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v1
      - name: Setup env
        run: |
          echo "::set-env name=LIBRA_GIT_REV::$(git rev-parse --short=8 HEAD)"
      - name: Build, tag and push images
        run: |
          docker/build-aws.sh --build-all --version $LIBRA_GIT_REV --addl_tags canary
      - name: Launch cluster test
        run: |
          JUMPHOST=${{secrets.CLUSTER_TEST_JUMPHOST}} \
          ./scripts/cti \
            --marker land \
            --tag dev_$LIBRA_GIT_REV \
            --report report.json \
            --run bench
      - name: Post test results on PR
        if: always()
        uses: actions/github-script@0.4.0
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            // Find the number of the pull request that trigggers this push
            let pr_num = 0;
            let commit_message = context.payload.head_commit.message;
            let re = /.*[^]Closes:\s\#(\d+)[^]Approved\sby:\s\w+$/;
            if (re.test(commit_message)) {
              let match = re.exec(commit_message);
              pr_num = match[1];
            } else {
              console.warn("Did not find pull request num in commit message. -\\_(O_o)_/-");
              return;
            }
            // Read and check cluster test results
            let should_fail = false;
            let body;
            const fsp = require('fs').promises;
            try {
              data = await fsp.readFile('report.json', 'utf-8');
              var result = JSON.parse(data);
              // TODO - set P/F based on metrics TPS, latency<commit_msg>[GHA] add debug log when PR is not found<commit_after>---
name: Land-blocking Test

on:
  push:
    branches:
      - auto

jobs:
  build-and-run-cluster-test:
    name: Build images and run cluster test
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v1
      - name: Setup env
        run: |
          echo "::set-env name=LIBRA_GIT_REV::$(git rev-parse --short=8 HEAD)"
      - name: Build, tag and push images
        run: |
          docker/build-aws.sh --build-all --version $LIBRA_GIT_REV --addl_tags canary
      - name: Launch cluster test
        run: |
          JUMPHOST=${{secrets.CLUSTER_TEST_JUMPHOST}} \
          ./scripts/cti \
            --marker land \
            --tag dev_$LIBRA_GIT_REV \
            --report report.json \
            --run bench
      - name: Post test results on PR
        if: always()
        uses: actions/github-script@0.4.0
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            // Find the number of the pull request that trigggers this push
            let pr_num = 0;
            let commit_message = context.payload.head_commit.message;
            let re = /.*[^]Closes:\s\#(\d+)[^]Approved\sby:\s\w+$/;
            if (re.test(commit_message)) {
              let match = re.exec(commit_message);
              pr_num = match[1];
            } else {
              console.warn("Did not find pull request num in commit message. -\\_(O_o)_/-");
              console.log("GH event payload\n", context.payload);
              return;
            }
            // Read and check cluster test results
            let should_fail = false;
            let body;
            const fsp = require('fs').promises;
            try {
              data = await fsp.readFile('report.json', 'utf-8');
              var result = JSON.parse(data);
              // TODO - set P/F based on metrics TPS, latency
{'fraction_non_alphanumeric': 0.11899006177813591, 'fraction_numerical': 0.0042976094547408005, 'mean_word_length': 1.5333333333333334, 'pattern_counts': {'":': 2, '<': 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': '3499726', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1110, 'n_words': 297}