| 1 | name: Coverage |
| 2 | |
| 3 | on: [push, pull_request] |
| 4 | |
| 5 | jobs: |
| 6 | coverage: |
| 7 | runs-on: ubuntu-latest |
| 8 | steps: |
| 9 | - uses: actions/checkout@v2 |
| 10 | - name: Install toolchain |
| 11 | uses: actions-rs/toolchain@v1 |
| 12 | with: |
| 13 | profile: minimal |
| 14 | target: x86_64-unknown-linux-gnu |
| 15 | toolchain: nightly |
| 16 | override: true |
| 17 | - name: Install grcov |
| 18 | run: curl -L https://github.com/mozilla/grcov/releases/download/v0.6.1/grcov-linux-x86_64.tar.bz2 | tar jxf - |
| 19 | - name: Install rust-covfix |
| 20 | run: | |
| 21 | curl -L https://github.com/Kogia-sima/rust-covfix/releases/download/v0.2.2/rust-covfix-linux-x86_64.tar.xz |tar Jxf - |
| 22 | mv rust-covfix-linux-x86_64/rust-covfix ./ |
| 23 | - name: Test all crates |
| 24 | env: |
| 25 | CARGO_INCREMENTAL: 0 |
| 26 | RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -C panic=abort |
| 27 | RUSTDOCFLAGS: -C panic=abort |
| 28 | run: | |
| 29 | cargo test --no-default-features --features std |
| 30 | cargo test --all-features |
| 31 | - name: collect coverages |
| 32 | run: | |
| 33 | zip -0 ccov.zip `find . -name "itoap*.gc*" -print` |
| 34 | ./grcov ccov.zip --llvm --branch -t lcov -o lcov.info --ignore "/*" |
| 35 | - name: fix coverages |
| 36 | run: ./rust-covfix -o lcov.info lcov.info |
| 37 | - name: upload coverage |
| 38 | uses: codecov/codecov-action@v1 |
| 39 | with: |
| 40 | file: ./lcov.info |