-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (42 loc) · 1.17 KB
/
ci-ml.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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-llvm-cov
for toml in $(find crates/ml -name "Cargo.toml"); do
echo "Running tests for $toml"
cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info
done
- 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