Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(actions): implement code coverage #800

Merged
merged 6 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 39 additions & 6 deletions .github/workflows/build.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ on:
- '**.rs'
- 'Cargo.*'
- '*/Cargo.*'
- '.github/workflows/*'
push:
branches:
- main

name: Build and Test
name: CI

env:
RUSTFLAGS: "-D warnings"

defaults:
run:
shell: bash

jobs:
test:
name: Build and test on ${{ matrix.os }} with ${{ matrix.features }}
name: Build and test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -25,7 +33,7 @@ jobs:
- macOS-latest
- windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
Expand All @@ -35,9 +43,9 @@ jobs:
with:
shared-key: ${{ runner.os }}-cargo

- uses: taiki-e/install-action@v1
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack
tool: cargo-hack,cargo-llvm-cov,nextest

# - name: Check benchmarks
# uses: actions-rs/cargo@v1
Expand All @@ -56,5 +64,30 @@ jobs:
if: ${{ matrix.os != 'windows-latest' }}
run: cargo hack doc --verbose --no-deps --each-feature --no-dev-deps --optional-deps url -p rumqttc -p rumqttd

- name: Doctests
run: cargo hack --each-feature --optional-deps url test --doc -p rumqttc -p rumqttd

- name: Test rumqttc and rumqttd
run: cargo hack test --verbose --each-feature --optional-deps url -p rumqttc -p rumqttd
run: |
cargo hack --each-feature --optional-deps url llvm-cov -p rumqttc -p rumqttd --no-report nextest

- name: Combine coverage
run: cargo llvm-cov report --lcov --output-path coverage.lcov

- name: Upload Coverage Report
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./coverage.lcov
parallel: true
flag-name: run-${{ matrix.os }}-cargo

finish-coverage:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Finish Coverage Report
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
80 changes: 0 additions & 80 deletions .github/workflows/main.yml

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<div align="center">
<img alt="rumqtt Logo" src="docs/rumqtt.png" width="60%" />
<img alt="rumqtt Logo" src="docs/rumqtt.png" width="60%" />
</div>
<div align="center">
<a href="https://github.com/bytebeamio/rumqtt/actions/workflows/main.yml">
<img alt="build status" src="https://github.com/bytebeamio/rumqtt/actions/workflows/main.yml/badge.svg">
<a href="https://github.com/bytebeamio/rumqtt/actions/workflows/ci.yml">
<img alt="build status" src="https://github.com/bytebeamio/rumqtt/actions/workflows/ci.yml/badge.svg">
</a>
<a href="https://coveralls.io/github/bytebeamio/rumqtt?branch=main">
<img src="https://coveralls.io/repos/github/bytebeamio/rumqtt/badge.svg?branch=main" alt="Coverage Status" />
</a>
<a href="https://discord.gg/mpkSqDg">
<img alt="Discord chat" src="https://img.shields.io/discord/633193308033646605?style=flat">
Expand Down