apprtc 0.4.0

AppRTC P2P/SFU Server in Rust
Documentation
name: coverage

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

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  grcov:
    name: Coverage
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-latest
        toolchain:
          - nightly
        cargo_flags:
          - "--all-features"
    steps:
      - name: Checkout source code
        uses: actions/checkout@v4
        with:
          submodules: recursive

      - name: Install Rust
        uses: dtolnay/rust-toolchain@nightly
        with:
          components: llvm-tools-preview

      - name: Rust Cache
        uses: Swatinem/rust-cache@v2

      - name: Install grcov
        uses: taiki-e/install-action@v2
        with:
          tool: grcov

      - name: Test
        run: cargo test --lib --bins --no-fail-fast ${{ matrix.cargo_flags }}
        env:
          CARGO_INCREMENTAL: "0"
          RUSTFLAGS: "-Cinstrument-coverage"
          LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"

      - name: Generate coverage data
        id: grcov
        run: |
          grcov . \
              --binary-path ./target/debug/ \
              --source-dir . \
              --output-type lcov \
              --output-path lcov.info \
              --branch \
              --ignore='/**' \
              --ignore='C:/**' \
              --ignore='../**' \
              --ignore-not-existing \
              --excl-line "#\\[derive\\(" \
              --excl-br-line "#\\[derive\\(" \
              --excl-start "#\\[cfg\\(test\\)\\]" \
              --excl-br-start "#\\[cfg\\(test\\)\\]"
      - name: Upload coverage as artifact
        uses: actions/upload-artifact@v4
        with:
          name: lcov.info
          # path: ${{ steps.grcov.outputs.report }}
          path: lcov.info

      - name: Upload coverage to codecov.io
        uses: codecov/codecov-action@v5
        with:
          files: lcov.info
          fail_ci_if_error: true