Add config for CI pipeline and code coverage

This commit is contained in:
natalie 2023-04-25 13:30:31 +01:00
parent 5b6f66e29c
commit 5e46d6317f
5 changed files with 176 additions and 3 deletions

22
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
timezone: America/New_York
open-pull-requests-limit: 10
reviewers:
- natalieesk
assignees:
- natalieesk
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
timezone: America/New_York
open-pull-requests-limit: 10
reviewers:
- natalieesk
assignees:
- natalieesk

47
.github/workflows/coverage.yaml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Coverage
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
path:
- '**/*.rs'
- '**/*.txt'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'codecov.yml'
- '.github/workflows/coverage.yml'
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v3.5.2
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
components: llvm-tools-preview
- name: Install cargo-llvm-cov cargo command
run: cargo install cargo-llvm-cov
- name: Run tests
run: cargo llvm-cov --lcov --no-report --ignore-filename-regex 'tests.rs'
- name: Generate coverage report
run: cargo llvm-cov report --lcov --ignore-filename-regex 'tests.rs' --output-path lcov.info
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3.1.2

78
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,78 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/action-has-permission@1.0.6
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy action to produce annotations
uses: actions-rs/clippy-check@v1.0.7
if: ${{ steps.check_permissions.outputs.has-permission }}
with:
# GitHub displays the clippy job and its results as separate entries
name: Clippy (stable) Results
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
- name: Run clippy manually without annotations
if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --all-features --all-targets -- -D warnings
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
components: rustfmt
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1.0.3
with:
command: fmt
args: --all -- --check
actionlint:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3.5.2
- uses: reviewdog/action-actionlint@v1.37.0
with:
level: warning
fail_on_error: false

View File

@ -1,3 +0,0 @@
# Frost Trusted Dealer Demo
A CLI demo for running trusted dealer key generation with FROST

29
codecov.yml Normal file
View File

@ -0,0 +1,29 @@
coverage:
range: "50...100"
status:
project:
default:
informational: true
patch:
default:
informational: true
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: yes
macro: yes
# comment:
# layout: "diff"
# # if true: only post the comment if coverage changes
# require_changes: true
# This turns off the extra comment; the coverage %'s are still
# reported on the main PR page as check results
# comment: false
github_checks:
annotations: false