# DO NOT EDIT - GENERATED FROM .github/workflows/coverage.ys

name: coverage
defaults:
  run:
    shell: bash -e -x {0}
'on':
  workflow_dispatch: null
  push:
    branches:
    - master
  pull_request:
    branches:
    - master
env:
  PROJ_PKG_NAME: rapidyaml-
  PROJ_PFX_TARGET: ryml-
  PROJ_PFX_CMAKE: RYML_
  CMAKE_FLAGS: -DRYML_TEST_SUITE=ON
  NUM_JOBS_BUILD: null
jobs:
  coverage:
    if: always()
    continue-on-error: false
    name: cov/c++${{matrix.std}}/${{matrix.namesfx}}
    runs-on: ubuntu-24.04
    strategy:
      fail-fast: false
      matrix:
        include:
        - std: 11
          namesfx: 64bit
          cmk: -DCMAKE_CXX_FLAGS=-m64
        - std: 11
          namesfx: 64bit_dbg
          cmk: -DCMAKE_CXX_FLAGS=-m64 -DRYML_DBG=ON
        - std: 17
          namesfx: 64bit
          cmk: -DCMAKE_CXX_FLAGS=-m64
        - std: 17
          namesfx: 64bit_dbg
          cmk: -DCMAKE_CXX_FLAGS=-m64 -DRYML_DBG=ON
        - std: 11
          namesfx: 32bit
          cmk: -DCMAKE_CXX_FLAGS=-m32
        - std: 11
          namesfx: 32bit_dbg
          cmk: -DCMAKE_CXX_FLAGS=-m32 -DRYML_DBG=ON
        - std: 17
          namesfx: 32bit
          cmk: -DCMAKE_CXX_FLAGS=-m32
        - std: 17
          namesfx: 32bit_dbg
          cmk: -DCMAKE_CXX_FLAGS=-m32 -DRYML_DBG=ON
    env:
      GCC_VERSION: 13
      LCOV_ARGS: -v --ignore-errors mismatch,mismatch --ignore-errors unused,unused
      BUILD_ID: cpp${{matrix.std}}_${{matrix.namesfx}}
      CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
    steps:
    - name: checkout (action)
      uses: actions/checkout@v4
      with:
        submodules: recursive
        fetch-depth: 0
    - name: install compiler
      run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update
        sudo apt-get install -y \
            build-essential \
            cmake \
            git \
            lcov \
            linux-libc-dev:i386 \
            libc6:i386 \
            libc6-dev:i386 \
            libc6-dbg:i386 \
            g++-$GCC_VERSION \
            g++-$GCC_VERSION-multilib
    - name: show info
      run: source .github/setenv.sh && c4_show_info
    - name: configure
      run: |
        cmake -B build/$BUILD_ID \
            -DCMAKE_BUILD_TYPE=Coverage \
            -DRYML_BUILD_TESTS=ON \
            -DRYML_COVERAGE_LCOV_ARGS=" $LCOV_ARGS " \
            -DRYML_COVERAGE_CODECOV=ON \
            ${{matrix.cmk}}
    - name: build
      run: |
        cmake --build build/$BUILD_ID --verbose --target ryml-test-build --parallel
    - name: run
      run: |
        cmake --build build/$BUILD_ID --verbose --target ryml-coverage
    - name: upload artifacts
      uses: actions/upload-artifact@v4
      with:
        name: coverage-${{env.BUILD_ID}}
        path: |
          build/${{env.BUILD_ID}}/lcov
          build/${{env.BUILD_ID}}/coverage3-final_filtered.lcov
    - name: upload codecov
      run: |
        cmake --build build/$BUILD_ID --target ryml-coverage-submit-codecov --verbose
    - name: upload coveralls
      uses: coverallsapp/github-action@v2
      with:
        github-token: ${{secrets.COVERALLS_REPO_TOKEN}}
        parallel: true
        files: build/${{env.BUILD_ID}}/coverage3-final_filtered.lcov
  coveralls_finish:
    needs: coverage
    if: ${{always()}}
    runs-on: ubuntu-24.04
    steps:
    - name: Coveralls Finished
      uses: coverallsapp/github-action@v2
      with:
        parallel-finished: true
