Merge pull request #48 from svartalf/ci-code-coverage

Ci code coverage
This commit is contained in:
Stjepan Glavina 2020-04-28 05:31:36 -07:00 committed by GitHub
commit db458b7c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 1 deletions

8
.github/actions-rs/grcov.yml vendored Normal file
View File

@ -0,0 +1,8 @@
branch: true
ignore-not-existing: true
llvm: true
output-type: lcov
ignore:
- "/*"
- "C:/*"
- "../*"

View File

@ -20,6 +20,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Run cargo check

62
.github/workflows/coverage.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: Code Coverage
on: [push, pull_request]
jobs:
grcov:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Run cargo test
if: startsWith(matrix.os, 'macOS') == false
uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
# The only difference from previous step is that `RUSTFLAGS` `-Clink-dead-code` flag
# is removed for macOS tests because `core-foundation` crate breaks compilation.
#
# See https://github.com/rust-lang/rust/issues/63047 for details
- name: Run cargo test (macOS)
if: startsWith(matrix.os, 'macOS') == true
uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Coverflow-checks=off'
- name: Run grcov
id: coverage
uses: actions-rs/grcov@v0.1
- name: Coveralls upload
uses: coverallsapp/github-action@v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
grcov_finalize:
runs-on: ubuntu-latest
needs: grcov
steps:
- name: Finalize Coveralls upload
uses: coverallsapp/github-action@v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

View File

@ -11,7 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -2,6 +2,8 @@
[![Build](https://github.com/stjepang/smol/workflows/Build%20and%20test/badge.svg)](
https://travis-ci.org/stjepang/smol)
[![Coverage Status](https://coveralls.io/repos/github/stjepang/smol/badge.svg?branch=master)](
https://coveralls.io/github/stjepang/smol?branch=master)
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](
https://github.com/stjepang/smol)
[![Cargo](https://img.shields.io/crates/v/smol.svg)](