xd009642 / tarpaulin

A code coverage tool for Rust projects
https://crates.io/crates/cargo-tarpaulin
Apache License 2.0
2.5k stars 180 forks source link

Unrecognized option run-types #597

Closed al8n closed 3 years ago

al8n commented 3 years ago

I follow the #13 and try to get the coverage of doctests in Github Action.

Here is my ci.yml:

name: CI

on:
  push:
    branches:
      - main
    paths-ignore:
    - 'COPYRIGHT'
    - 'LICENSE-*'
    - '**.md'
    - '**.txt'
  pull_request:
    paths-ignore:
    - 'COPYRIGHT'
    - 'LICENSE-*'
    - '**.md'
    - '**.txt'

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - nightly

    steps:
      - uses: actions/checkout@v2
      - name: Install latest nightly
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          override: true
          components: rustfmt, clippy

      - name: Run cargo vendor
        uses: actions-rs/cargo@v1
        with:
          command: vendor

      - name: Run cargo check
        uses: actions-rs/cargo@v1
        with:
          command: check

      - name: Run cargo-tarpaulin
        uses: actions-rs/tarpaulin@v0.1
        with:
          args: '-- --run-types Doctests Tests'

      - name: Upload to codecov.io
        uses: codecov/codecov-action@v1.0.2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true

Here is the error:

...
error: Unrecognized option: 'run-types'
Error: Error: "Test failed during run"
Error: The process '/usr/share/rust/.cargo/bin/cargo' failed with exit code 1
xd009642 commented 3 years ago

You need to remove the preceding --, so just args: '--run-types Doctests Tests'. Any arguments after the -- get forwarded to the test executable and aren't processed by tarpaulin