<commit_before>name: Build and Test

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-18.04
    strategy:
      fail-fast: false
      matrix:
        swift: ["5.2.4-bionic", "5.1.5-bionic", "5.0.3-bionic", "4.2.4"]
        # protobuf_git can reference a commit, tag, or branch
        # commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
        # tag: "ref/tags/v3.11.4"
        # branch: "ref/heads/master"
        protobuf_git: ["ref/heads/master"]
    container:
      image: swift:${{ matrix.swift }}
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        path: main
    - name: Update and install dependencies
      # dependencies from https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
      # this step is run before get-sha because we need curl and jq for get-sha
      # NOTE: zlib1g-dev is added to fix the Swift 5.0.x builds, when those builds aren't needed
      # that dep likely can be removed.
      run: apt-get update && apt-get install -y autoconf automake libtool curl make g++ unzip jq zlib1g-dev
    - name: Get Protobuf Commit SHA
      id: get-sha
      run: |
        set -eu
        url="https://api.github.com/repos/protocolbuffers/protobuf/git/${{ matrix.protobuf_git }}"
        case ${{ matrix.protobuf_git }} in
        ref/*)
          echo ::set-output name=sha::$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .object.sha )
          ;;
        commits/*)
          echo ::set-output name=sha::$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .sha )
          ;;
        esac
    - name: Build
      working-directory: main
      run: make build
    - name: Test runtime
      working-directory: main
      run: make test-runtime
    - name: Cache protobuf
      id: cache-protobuf
      uses: actions/cache@v1
      with:
        path: protobuf
        # NOTE: for refs that can float like 'master' the cache might be out of date!
        key: ${{ runner.os }}-${{ matrix.swift}}-protobuf-${{ steps.get-sha.outputs.sha }}
    - name: Checkout protobuf repo
      if: steps.cache-protobuf.outputs.cache-hit != 'true'
      uses: actions/checkout@v2
      with:
        repository: protocolbuffers/protobuf
        ref: ${{ steps.get-sha.outputs.sha }}
        path: protobuf
    - name: Build protobuf
      if: steps.cache-protobuf.outputs.cache-hit != 'true'
      working-directory: protobuf
      run: |
        ./autogen.sh
        ./configure
        make -C ./src
        make -C ./conformance
    - name: Test plugin
      working-directory: main
      run: make test-plugin PROTOC=../protobuf/src/protoc
    - name: Test conformance
      working-directory: main
      run: make test-conformance
<commit_msg>CI: Move up the 5.2.x image to the new release.<commit_after>name: Build and Test

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-18.04
    strategy:
      fail-fast: false
      matrix:
        swift: ["5.2.5-bionic", "5.1.5-bionic", "5.0.3-bionic", "4.2.4"]
        # protobuf_git can reference a commit, tag, or branch
        # commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
        # tag: "ref/tags/v3.11.4"
        # branch: "ref/heads/master"
        protobuf_git: ["ref/heads/master"]
    container:
      image: swift:${{ matrix.swift }}
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        path: main
    - name: Update and install dependencies
      # dependencies from https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
      # this step is run before get-sha because we need curl and jq for get-sha
      # NOTE: zlib1g-dev is added to fix the Swift 5.0.x builds, when those builds aren't needed
      # that dep likely can be removed.
      run: apt-get update && apt-get install -y autoconf automake libtool curl make g++ unzip jq zlib1g-dev
    - name: Get Protobuf Commit SHA
      id: get-sha
      run: |
        set -eu
        url="https://api.github.com/repos/protocolbuffers/protobuf/git/${{ matrix.protobuf_git }}"
        case ${{ matrix.protobuf_git }} in
        ref/*)
          echo ::set-output name=sha::$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .object.sha )
          ;;
        commits/*)
          echo ::set-output name=sha::$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .sha )
          ;;
        esac
    - name: Build
      working-directory: main
      run: make build
    - name: Test runtime
      working-directory: main
      run: make test-runtime
    - name: Cache protobuf
      id: cache-protobuf
      uses: actions/cache@v1
      with:
        path: protobuf
        # NOTE: for refs that can float like 'master' the cache might be out of date!
        key: ${{ runner.os }}-${{ matrix.swift}}-protobuf-${{ steps.get-sha.outputs.sha }}
    - name: Checkout protobuf repo
      if: steps.cache-protobuf.outputs.cache-hit != 'true'
      uses: actions/checkout@v2
      with:
        repository: protocolbuffers/protobuf
        ref: ${{ steps.get-sha.outputs.sha }}
        path: protobuf
    - name: Build protobuf
      if: steps.cache-protobuf.outputs.cache-hit != 'true'
      working-directory: protobuf
      run: |
        ./autogen.sh
        ./configure
        make -C ./src
        make -C ./conformance
    - name: Test plugin
      working-directory: main
      run: make test-plugin PROTOC=../protobuf/src/protoc
    - name: Test conformance
      working-directory: main
      run: make test-conformance

{'fraction_non_alphanumeric': 0.12629325722440243, 'fraction_numerical': 0.018194791295041028, 'mean_word_length': 2.106371191135734, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5419356', 'n_tokens_mistral': 1854, 'n_tokens_neox': 1776, 'n_words': 501}