<commit_before>name: build

on: 
  pull_request:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        include:
          - build_type: Debug
          - build_type: Release

    env:
      EXTERNAL_ROOT: /home/runner/3party
      BUILD_TYPE: ${{ matrix.build_type }}

    steps:
    - uses: actions/checkout@v2

    - name: Install latest Boost
      shell: bash
      run: |
        sudo apt-add-repository ppa:mhier/libboost-latest
        sudo apt install boost1.74
      
    - name: Install dependencies from source
      run: .ci/fetch_system_dependencies.sh
      
    - name: Create Build Environment
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT

    - name: Build
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake --build . --config $BUILD_TYPE

    - name: Test
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ctest -C $BUILD_TYPE

  build-conan:
    runs-on: ubuntu-latest

    env:
      BUILD_TYPE: Release

    steps:
    - uses: actions/checkout@v2

    - name: Extract branch name
      shell: bash
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
      id: extract_branch

    # Build a cache for conan packages.  A new branch will create a copy of
    # the master cache, but the master cache isn't updated until something is
    # merged to the master branch.
    - name: Cache conan packages
      uses: actions/cache@v2
      with:
        path: ~/.conan
        key: conan-package-cache-${{ steps.extract_branch.outputs.branch }}
        restore-keys: |
          conan-package-cache-master

    - name: Install Conan
      run: |
        pip3 install --upgrade --user wheel setuptools
        pip3 install --user conan
        echo "$HOME/.local/bin" >> $GITHUB_PATH

    - name: Create Build Environment
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Install dependencies from Conan
      working-directory: ${{runner.workspace}}/build
      run: |
        conan config set general.request_timeout=120
        conan install $GITHUB_WORKSPACE -s compiler.libcxx=libstdc++11 -s cppstd=14 -s build_type=$BUILD_TYPE --build=missing

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

    - name: Build
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: cmake --build . --config $BUILD_TYPE

    - name: Test
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ctest -C $BUILD_TYPE

  build-coverage:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        include:
          - build_type: Release

    env:
      EXTERNAL_ROOT: /home/runner/3party
      BUILD_TYPE: ${{ matrix.build_type }}

    steps:
    - uses: actions/checkout@v2

    - name: Install latest Boost
      shell: bash
      run: |
        sudo apt-add-repository ppa:mhier/libboost-latest
        sudo apt install boost1.74

    - name: Extract branch name
      shell: bash
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
      id: extract_branch

    # Build a cache for LCOV.
    - name: Cache lcov
      uses: actions/cache@v2
      with:
        path: ~/.lcov
        key: lcov-cache-${{ steps.extract_branch.outputs.branch }}
        restore-keys: |
          lcov-cache-master

    - name: Install LCOV
      shell: bash
      run: |
        if [ ! -f "$HOME/.lcov/local/bin/lcov" ]; then
          mkdir $HOME/.lcov-build || true;
          cd $HOME/.lcov-build;
          wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz;
          tar -xzf lcov_1.13.orig.tar.gz;
          mkdir -p $HOME/.lcov || true;
          DESTDIR=$HOME/.lcov make -C lcov-1.13/ install;
        fi
        echo "##[set-output name=bin;]$(echo $HOME/.lcov/usr/local/bin/lcov)"
      id: lcov

    - name: Install dependencies from source
      run: .ci/fetch_system_dependencies.sh
      
    - name: Create Build Environment
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT -DTERMINALPP_COVERAGE=True

    - name: Build
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake --build . --config $BUILD_TYPE

    - name: Zero test counters
      shell: bash
      run: ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-7 --base-directory ${{runner.workspace}}/build --directory ${{runner.workspace}}/build --zerocounters -q

    - name: Test
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ctest -C $BUILD_TYPE

    - name: Calculate coverage
      shell: bash
      run: |
        ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-7 --base-directory ${{runner.workspace}}/build --directory ${{runner.workspace}}/build  --capture --output-file coverage.info;
        ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-7 --remove coverage.info '*/test/*' '/usr/*' '*/3party/*' --output-file coverage.info;
        ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-7 --list coverage.info;

    - name: Post coverage
      uses: coverallsapp/github-action@master
      with:
        path-to-lcov: coverage.info
        github-token: ${{ secrets.GITHUB_TOKEN }}

  build-docs:
    runs-on: ubuntu-latest
#   Only build documentation for valid builds on master.
    needs: [build, build-conan]
    if: github.ref == 'refs/heads/master'

    steps:<commit_msg>Boost package in CI has changed name (#253)<commit_after>name: build

on: 
  pull_request:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        include:
          - build_type: Debug
          - build_type: Release

    env:
      EXTERNAL_ROOT: /home/runner/3party
      BUILD_TYPE: ${{ matrix.build_type }}

    steps:
    - uses: actions/checkout@v2

    - name: Install latest Boost
      shell: bash
      run: |
        sudo apt-add-repository ppa:mhier/libboost-latest
        sudo apt install libboost1.74-dev
      
    - name: Install dependencies from source
      run: .ci/fetch_system_dependencies.sh
      
    - name: Create Build Environment
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT

    - name: Build
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake --build . --config $BUILD_TYPE

    - name: Test
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ctest -C $BUILD_TYPE

  build-conan:
    runs-on: ubuntu-latest

    env:
      BUILD_TYPE: Release

    steps:
    - uses: actions/checkout@v2

    - name: Extract branch name
      shell: bash
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
      id: extract_branch

    # Build a cache for conan packages.  A new branch will create a copy of
    # the master cache, but the master cache isn't updated until something is
    # merged to the master branch.
    - name: Cache conan packages
      uses: actions/cache@v2
      with:
        path: ~/.conan
        key: conan-package-cache-${{ steps.extract_branch.outputs.branch }}
        restore-keys: |
          conan-package-cache-master

    - name: Install Conan
      run: |
        pip3 install --upgrade --user wheel setuptools
        pip3 install --user conan
        echo "$HOME/.local/bin" >> $GITHUB_PATH

    - name: Create Build Environment
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Install dependencies from Conan
      working-directory: ${{runner.workspace}}/build
      run: |
        conan config set general.request_timeout=120
        conan install $GITHUB_WORKSPACE -s compiler.libcxx=libstdc++11 -s cppstd=14 -s build_type=$BUILD_TYPE --build=missing

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

    - name: Build
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: cmake --build . --config $BUILD_TYPE

    - name: Test
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ctest -C $BUILD_TYPE

  build-coverage:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        include:
          - build_type: Release

    env:
      EXTERNAL_ROOT: /home/runner/3party
      BUILD_TYPE: ${{ matrix.build_type }}

    steps:
    - uses: actions/checkout@v2

    - name: Install latest Boost
      shell: bash
      run: |
        sudo apt-add-repository ppa:mhier/libboost-latest
        sudo apt install libboost1.74-dev

    - name: Extract branch name
      shell: bash
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
      id: extract_branch

    # Build a cache for LCOV.
    - name: Cache lcov
      uses: actions/cache@v2
      with:
        path: ~/.lcov
        key: lcov-cache-${{ steps.extract_branch.outputs.branch }}
        restore-keys: |
          lcov-cache-master

    - name: Install LCOV
      shell: bash
      run: |
        if [ ! -f "$HOME/.lcov/local/bin/lcov" ]; then
          mkdir $HOME/.lcov-build || true;
          cd $HOME/.lcov-build;
          wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.14.orig.tar.gz;
          tar -xzf lcov_1.14.orig.tar.gz;
          mkdir -p $HOME/.lcov || true;
          DESTDIR=$HOME/.lcov make -C lcov-1.14/ install;
        fi
        echo "##[set-output name=bin;]$(echo $HOME/.lcov/usr/local/bin/lcov)"
      id: lcov

    - name: Install dependencies from source
      run: .ci/fetch_system_dependencies.sh
      
    - name: Create Build Environment
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT -DTERMINALPP_COVERAGE=True

    - name: Build
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: cmake --build . --config $BUILD_TYPE

    - name: Zero test counters
      shell: bash
      run: ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-9 --base-directory ${{runner.workspace}}/build --directory ${{runner.workspace}}/build --zerocounters -q

    - name: Test
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ctest -C $BUILD_TYPE

    - name: Calculate coverage
      shell: bash
      run: |
        ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-9 --base-directory ${{runner.workspace}}/build --directory ${{runner.workspace}}/build  --capture --output-file coverage.info;
        ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-9 --remove coverage.info '*/test/*' '/usr/*' '*/3party/*' --output-file coverage.info;
        ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-9 --list coverage.info;

    - name: Post coverage
      uses: coverallsapp/github-action@master
      with:
        path-to-lcov: coverage.info
        github-token: ${{ secrets.GITHUB_TOKEN }}

  build-docs:
    runs-on: ubuntu-latest
#   Only build documentation for valid builds on master.
    needs: [build, build-conan]
    if: github.ref == 'refs/heads/master'

    steps:
{'fraction_non_alphanumeric': 0.12248827863362358, 'fraction_numerical': 0.0062793034159410585, 'mean_word_length': 2.2797913234486544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5419353', 'n_tokens_mistral': 3989, 'n_tokens_neox': 3717, 'n_words': 914}