Skip to content

Commit

Permalink
Add CI/CD workflow for unit tests and coverage check
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad-Edwards committed Jan 2, 2025
1 parent ee7caf3 commit 1834f98
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

name: CI/CD

on:
push:
branches:
- chore/basic-ci-cd
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install dependencies
run: sudo apt-get install lcov
- name: Run tests
run: |
cargo test --manifest-path crates/cs/Cargo.toml
- name: Generate coverage report
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --out Xml --manifest-path crates/cs/Cargo.toml
- name: Check coverage
run: |
bash <(curl -s https://codecov.io/bash) -f lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Fail if coverage is below 90%
run: |
bash <(curl -s https://codecov.io/bash) -f lcov.info
if [ $(lcov --summary lcov.info | grep -Eo '[0-9]+\.[0-9]+' | head -1) -lt 90 ]; then
echo "Coverage is below 90%";
exit 1;
fi

0 comments on commit 1834f98

Please sign in to comment.