<commit_before># Build library and examples, and generate releases.
name: FusionEngine Client Build

on:
  push:
    # Build on a push to any branch.
    branches:
      - '*'
    # Build on a push of any tag named v* (v1.0, etc.) and generate a release.
    tags:
      - 'v*'

jobs:
  # Build the library and example applications (Bazel).
  build_bazel:
    name: Bazel Build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        compiler: [g++, clang++]
    steps:
    - uses: actions/checkout@v2

    # Compile.
    - name: Install Bazel 3.3.0
      uses: abhinavsingh/setup-bazel@v3
      with:
        version: 3.3.0

    - name: Build Library
      env:
        CC: /usr/bin/${{ matrix.compiler }}
      run: |
        bazel build -c opt //:*

    - name: Build Examples
      env:
        CC: /usr/bin/${{ matrix.compiler }}
      run: |
        cd examples &&
        bazel build -c opt //:*

    - name: Install Test Files
      run: |
        mkdir test
        cp examples/bazel-bin/message_decode/message_decode ./test/
        cp examples/bazel-bin/generate_data/generate_data ./test/
        cp examples/message_decode/example_data.p1bin ./test/

    # Run unit tests.
    - name: Test Message Decoding
      run: |
        cd test
        ./message_decode example_data.p1bin

    - name: Test Message Encoding
      run: |
        cd test
        ./generate_data new_data.p1bin &&
        ./message_decode new_data.p1bin

  # Build the library and example applications (CMake).
  build_cmake:
    name: CMake Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        compiler: [g++, clang++]
        include:
          - os: windows-latest
            compiler: msvc
    defaults:
      run:
        shell: bash
    steps:
    - uses: actions/checkout@v2

    # Compile.
    - name: Install CMake 3.16.x
      uses: jwlawson/actions-setup-cmake@v1.3
      with:
        cmake-version: '3.16.x'

    - name: Install msbuild (Windows)
      if: matrix.os == 'windows-latest'
      uses: microsoft/setup-msbuild@v1.0.1

    - name: Setup Environment (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        echo ::set-env name=EXT::.exe

    - name: Setup Environment (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        echo ::set-env name=CXX::/usr/bin/${{ matrix.compiler }}
        echo ::set-env name=EXT::

    - name: Setup Build
      run: |
        mkdir cmake_build
        cd cmake_build
        cmake -DCMAKE_INSTALL_PREFIX=install ..

    - name: Build Library And Examples (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        cd cmake_build
        make
        make install

    - name: Install Test Files (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        mkdir test
        cp cmake_build/examples/message_decode/message_decode ./test/
        cp cmake_build/examples/generate_data/generate_data ./test/
        cp examples/message_decode/example_data.p1bin ./test/

    - name: Build Library And Examples (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        cd cmake_build
        MSBuild.exe p1_fusion_engine_client.sln

    - name: Install Test Files (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        mkdir test
        cp cmake_build/Debug/fusion_engine_client.dll ./test/
        cp cmake_build/examples/message_decode/Debug/message_decode.exe ./test/
        cp cmake_build/examples/generate_data/Debug/generate_data.exe ./test/
        cp examples/message_decode/example_data.p1bin ./test/

    # Run unit tests.
    - name: Test Message Decoding
      run: |
        cd test
        ./message_decode${EXT} example_data.p1bin

    - name: Test Message Encoding
      run: |
        cd test
        ./generate_data${EXT} new_data.p1bin
        ./message_decode${EXT} new_data.p1bin

  # Build the documentation.
  build_doxygen:
    name: Documentation Build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        doxygen: [1_8_18]
    steps:
    - uses: actions/checkout@v2
      with:
        # Note: Checking out with full tag history for version query below.
        fetch-depth: 0

    - name: Setup Doxygen Cache
      uses: actions/cache@v2
      id: cache-doxygen
      with:
        path: |
          doxygen
        key: doxygen-source-${{ matrix.doxygen }}

    - name: Install CMake 3.16.x
      uses: jwlawson/actions-setup-cmake@v1.3
      with:
        cmake-version: '3.16.x'

    - name: Build Doxygen
      if: steps.cache-doxygen.outputs.cache-hit != 'true'
      run: |
        sudo apt install -y flex bison
        git clone --depth 1 --branch Release_${{ matrix.doxygen }} https://github.com/doxygen/doxygen.git
        mkdir doxygen/build
        cd doxygen/build
        cmake ..
        make -j4

    - name: Install Doxygen
      run: |
        cd doxygen/build
        sudo make install

    - name: Extract Tag Name
      if: startsWith(github.ref, 'refs/tags/') || endsWith(github.ref, '/master')
      run: echo "::set-env name=GIT_TAG::${GITHUB_REF##*/}"

    - name: Extract Commit Hash
      if: "!(startsWith(github.ref, 'refs/tags/') || endsWith(github.ref, '/master'))"
      run: echo "::set-env name=GIT_TAG::${GITHUB_SHA}"

    - name: Build Documentation
      run: |
        echo "Setting documentation version to: ${GIT_TAG}"
        python3 docs/update_versions.py ${GIT_TAG}
        doxygen Doxyfile.version
        cp docs/include_header.js docs/html/
        tar czf fusion-engine-client-docs.tar.gz docs/html --transform 's|^docs/html|fusion-engine-client/docs/html|'

    - name: Upload Artifact
      uses: actions/upload-artifact@v1
      with:
        name: fusion-engine-client-docs.tar.gz
        path: fusion-engine-client-docs.tar.gz

  # Upload release (v*) or master documentation to S3.
  upload_doxygen:
    name: Upload Documentation
    if: startsWith(github.ref, 'refs/tags/') || endsWith(github.ref, '/master')
    needs: [build_doxygen]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        # Note: Checking out with full tag history for version query below.
        fetch-depth: 0

    - name: Get Documentation Artifact
      uses: actions/download-artifact@v2
      with:
        name: fusion-engine-client-docs.tar.gz

    - name: Configure AWS Credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: us-east-1

    - name: Extract Tag Name
      run: |
        echo "::set-env name=GIT_TAG::${GITHUB_REF##*/}"
        echo "Setting tag to: ${GIT_TAG}"

    - name: Upload Documentation To Web (S3)
      run: |
        echo "Setting documentation version to: ${GIT_TAG}"
        python3 docs/update_versions.py ${GIT_TAG}
        tar xvzf fusion-engine-client-docs.tar.gz --strip-components=1
        aws s3 sync --delete --acl public-read docs/html s3://docs.pointonenav.com/fusion-engine/${GIT_TAG}
        aws s3 cp --acl public-read docs/include_header.js s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/versions.html s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/index.html s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/error.html s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/favicon.ico s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/point_one_logo.png s3://docs.pointonenav.com/fusion-engine/

  # Create a release only on a tag (not on a branch push).
  release:
    name: Create Release
    if: startsWith(github.ref, 'refs/tags/')
    needs: [build_bazel, build_cmake, build_doxygen, upload_doxygen]
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}
    steps:
    - name: Get Documentation Artifact
      uses: actions/download-artifact@v2
      with:
        name: fusion-engine-client-docs.tar.gz

    - name: Create Release
      id: create_release
      uses: actions/create-release@latest
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        draft: false
        prerelease: false

    - name: Upload Documentation To Release
      if: steps.create_release.conclusion == 'success'
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: fusion-engine-client-docs.tar.gz
        asset_name: fusion-engine-client-docs.tar.gz
        asset_content_type: application/tar+gzip
<commit_msg>Updated CI script to stop using deprecated set-env API.<commit_after># Build library and examples, and generate releases.
name: FusionEngine Client Build

on:
  push:
    # Build on a push to any branch.
    branches:
      - '*'
    # Build on a push of any tag named v* (v1.0, etc.) and generate a release.
    tags:
      - 'v*'

jobs:
  # Build the library and example applications (Bazel).
  build_bazel:
    name: Bazel Build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        compiler: [g++, clang++]
    steps:
    - uses: actions/checkout@v2

    # Compile.
    - name: Install Bazel 3.3.0
      uses: abhinavsingh/setup-bazel@v3
      with:
        version: 3.3.0

    - name: Build Library
      env:
        CC: /usr/bin/${{ matrix.compiler }}
      run: |
        bazel build -c opt //:*

    - name: Build Examples
      env:
        CC: /usr/bin/${{ matrix.compiler }}
      run: |
        cd examples &&
        bazel build -c opt //:*

    - name: Install Test Files
      run: |
        mkdir test
        cp examples/bazel-bin/message_decode/message_decode ./test/
        cp examples/bazel-bin/generate_data/generate_data ./test/
        cp examples/message_decode/example_data.p1bin ./test/

    # Run unit tests.
    - name: Test Message Decoding
      run: |
        cd test
        ./message_decode example_data.p1bin

    - name: Test Message Encoding
      run: |
        cd test
        ./generate_data new_data.p1bin &&
        ./message_decode new_data.p1bin

  # Build the library and example applications (CMake).
  build_cmake:
    name: CMake Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        compiler: [g++, clang++]
        include:
          - os: windows-latest
            compiler: msvc
    defaults:
      run:
        shell: bash
    steps:
    - uses: actions/checkout@v2

    # Compile.
    - name: Install CMake 3.16.x
      uses: jwlawson/actions-setup-cmake@v1.4
      with:
        cmake-version: '3.16.x'

    - name: Install msbuild (Windows)
      if: matrix.os == 'windows-latest'
      uses: microsoft/setup-msbuild@v1.0.2

    - name: Setup Environment (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        echo "EXT=.exe" >> $GITHUB_ENV

    - name: Setup Environment (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        echo "CXX=/usr/bin/${{ matrix.compiler }}" >> $GITHUB_ENV
        echo "EXT=" >> $GITHUB_ENV

    - name: Setup Build
      run: |
        mkdir cmake_build
        cd cmake_build
        cmake -DCMAKE_INSTALL_PREFIX=install ..

    - name: Build Library And Examples (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        cd cmake_build
        make
        make install

    - name: Install Test Files (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        mkdir test
        cp cmake_build/examples/message_decode/message_decode ./test/
        cp cmake_build/examples/generate_data/generate_data ./test/
        cp examples/message_decode/example_data.p1bin ./test/

    - name: Build Library And Examples (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        cd cmake_build
        MSBuild.exe p1_fusion_engine_client.sln

    - name: Install Test Files (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        mkdir test
        cp cmake_build/Debug/fusion_engine_client.dll ./test/
        cp cmake_build/examples/message_decode/Debug/message_decode.exe ./test/
        cp cmake_build/examples/generate_data/Debug/generate_data.exe ./test/
        cp examples/message_decode/example_data.p1bin ./test/

    # Run unit tests.
    - name: Test Message Decoding
      run: |
        cd test
        ./message_decode${EXT} example_data.p1bin

    - name: Test Message Encoding
      run: |
        cd test
        ./generate_data${EXT} new_data.p1bin
        ./message_decode${EXT} new_data.p1bin

  # Build the documentation.
  build_doxygen:
    name: Documentation Build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        doxygen: [1_8_18]
    steps:
    - uses: actions/checkout@v2
      with:
        # Note: Checking out with full tag history for version query below.
        fetch-depth: 0

    - name: Setup Doxygen Cache
      uses: actions/cache@v2
      id: cache-doxygen
      with:
        path: |
          doxygen
        key: doxygen-source-${{ matrix.doxygen }}

    - name: Install CMake 3.16.x
      uses: jwlawson/actions-setup-cmake@v1.4
      with:
        cmake-version: '3.16.x'

    - name: Build Doxygen
      if: steps.cache-doxygen.outputs.cache-hit != 'true'
      run: |
        sudo apt install -y flex bison
        git clone --depth 1 --branch Release_${{ matrix.doxygen }} https://github.com/doxygen/doxygen.git
        mkdir doxygen/build
        cd doxygen/build
        cmake ..
        make -j4

    - name: Install Doxygen
      run: |
        cd doxygen/build
        sudo make install

    - name: Extract Tag Name
      if: startsWith(github.ref, 'refs/tags/') || endsWith(github.ref, '/master')
      run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV

    - name: Extract Commit Hash
      if: "!(startsWith(github.ref, 'refs/tags/') || endsWith(github.ref, '/master'))"
      run: echo "GIT_TAG=${GITHUB_SHA}" >> $GITHUB_ENV

    - name: Build Documentation
      run: |
        echo "Setting documentation version to: ${GIT_TAG}"
        python3 docs/update_versions.py ${GIT_TAG}
        doxygen Doxyfile.version
        cp docs/include_header.js docs/html/
        tar czf fusion-engine-client-docs.tar.gz docs/html --transform 's|^docs/html|fusion-engine-client/docs/html|'

    - name: Upload Artifact
      uses: actions/upload-artifact@v1
      with:
        name: fusion-engine-client-docs.tar.gz
        path: fusion-engine-client-docs.tar.gz

  # Upload release (v*) or master documentation to S3.
  upload_doxygen:
    name: Upload Documentation
    if: startsWith(github.ref, 'refs/tags/') || endsWith(github.ref, '/master')
    needs: [build_doxygen]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        # Note: Checking out with full tag history for version query below.
        fetch-depth: 0

    - name: Get Documentation Artifact
      uses: actions/download-artifact@v2
      with:
        name: fusion-engine-client-docs.tar.gz

    - name: Configure AWS Credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: us-east-1

    - name: Extract Tag Name
      run: |
        echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
        echo "Setting tag to: ${GIT_TAG}"

    - name: Upload Documentation To Web (S3)
      run: |
        echo "Setting documentation version to: ${GIT_TAG}"
        python3 docs/update_versions.py ${GIT_TAG}
        tar xvzf fusion-engine-client-docs.tar.gz --strip-components=1
        aws s3 sync --delete --acl public-read docs/html s3://docs.pointonenav.com/fusion-engine/${GIT_TAG}
        aws s3 cp --acl public-read docs/include_header.js s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/versions.html s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/index.html s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/error.html s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/favicon.ico s3://docs.pointonenav.com/fusion-engine/
        aws s3 cp --acl public-read docs/point_one_logo.png s3://docs.pointonenav.com/fusion-engine/

  # Create a release only on a tag (not on a branch push).
  release:
    name: Create Release
    if: startsWith(github.ref, 'refs/tags/')
    needs: [build_bazel, build_cmake, build_doxygen, upload_doxygen]
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}
    steps:
    - name: Get Documentation Artifact
      uses: actions/download-artifact@v2
      with:
        name: fusion-engine-client-docs.tar.gz

    - name: Create Release
      id: create_release
      uses: actions/create-release@latest
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        draft: false
        prerelease: false

    - name: Upload Documentation To Release
      if: steps.create_release.conclusion == 'success'
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: fusion-engine-client-docs.tar.gz
        asset_name: fusion-engine-client-docs.tar.gz
        asset_content_type: application/tar+gzip

{'fraction_non_alphanumeric': 0.11402521386762719, 'fraction_numerical': 0.008554705087798289, 'mean_word_length': 2.1600569091232438, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4133215', 'n_tokens_mistral': 5933, 'n_tokens_neox': 5640, 'n_words': 1392}