From 2de660ae4d074f480777be286c492b61315f02e9 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 6 Jul 2021 11:22:05 +0200 Subject: [PATCH] Coveralls workflow applied also to stable (#342) * Coveralls (#339) * Add code coverage report as part of the workflows * Remove -Clink-dead-code which seems to be problematic * Manually set features to avoid debug_* failing unit tests. * Update badges * Add libraries directory to trigger code coverage reporting. * Fix coveralls badge not pointing to the branch * Badges to stable branch --- .github/actions-rs/grcov.yml | 9 +++++++ .github/workflows/coveralls.yml | 46 +++++++++++++++++++++++++++++++++ README.md | 9 ++++--- 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/actions-rs/grcov.yml create mode 100644 .github/workflows/coveralls.yml diff --git a/.github/actions-rs/grcov.yml b/.github/actions-rs/grcov.yml new file mode 100644 index 00000000..a6ef7de8 --- /dev/null +++ b/.github/actions-rs/grcov.yml @@ -0,0 +1,9 @@ +branch: true +ignore-not-existing: true +llvm: true +filter: covered +output-type: lcov +output-path: ./lcov.info +ignore: + - "third_party/*" + - "/*" diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 00000000..75ee6a40 --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,46 @@ +--- +name: OpenSK code coverage report +on: + push: + paths: + - 'src/**/*.rs' + - 'libraries/**/*.rs' + pull_request: + types: [opened, synchronize, reopened] + +jobs: + coveralls: + name: OpenSK code coverage + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + with: + submodules: "true" + - uses: actions-rs/toolchain@v1 + with: + target: thumbv7em-none-eabi + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel + - name: Set up OpenSK + run: ./setup.sh + + - uses: actions-rs/cargo@v1 + with: + command: test + args: --features "with_ctap1,with_nfc,std" --no-fail-fast + env: + CARGO_INCREMENTAL: '0' + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + - uses: actions-rs/grcov@v0.1 + id: coverage + - uses: coverallsapp/github-action@master + name: upload report to coveralls + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ${{ steps.coverage.outputs.report }} + diff --git a/README.md b/README.md index 81772201..5d16c8be 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # OpenSK logo -![markdownlint](https://github.com/google/OpenSK/workflows/markdownlint/badge.svg?branch=master) -![pylint](https://github.com/google/OpenSK/workflows/pylint/badge.svg?branch=master) -![Cargo check](https://github.com/google/OpenSK/workflows/Cargo%20check/badge.svg?branch=master) -![Cargo format](https://github.com/google/OpenSK/workflows/Cargo%20format/badge.svg?branch=master) +![markdownlint](https://github.com/google/OpenSK/workflows/markdownlint/badge.svg?branch=stable) +![pylint](https://github.com/google/OpenSK/workflows/pylint/badge.svg?branch=stable) +![Cargo check](https://github.com/google/OpenSK/workflows/Cargo%20check/badge.svg?branch=stable) +![Cargo format](https://github.com/google/OpenSK/workflows/Cargo%20format/badge.svg?branch=stable) +[![Coverage Status](https://coveralls.io/repos/github/google/OpenSK/badge.svg?branch=stable)](https://coveralls.io/github/google/OpenSK?branch=stable) ## OpenSK