-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (88 loc) · 3.11 KB
/
cov.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Code Coverage
on:
pull_request:
workflow_dispatch:
push:
branches: [master]
jobs:
check-coverage:
name: check-coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install rust
run: |
rustup toolchain install stable
rustup default stable
rustup update
- name: Caching
uses: Swatinem/rust-cache@v2
- name: Run unit tests to generate target dir
run: cargo test --all
- name: Copy osmosis-test-tube build files to mitigate code coverage error
run: |
cp $(find target/debug | grep libosmosistesttube.so) contracts/*
- name: install tarpaulin
run: cargo install cargo-tarpaulin --locked
- name: Generate code coverage
run: |
cargo tarpaulin --skip-clean --ignore-tests --frozen --engine llvm --out xml --exclude-files contracts/*/src/error.rs --exclude-files contracts/*/src/bin/*
- name: Produce the coverage report
uses: insightsengineering/coverage-action@v2
with:
# Path to the Cobertura XML report.
path: ./cobertura.xml
# Minimum total coverage, if you want to the
# workflow to enforce it as a standard.
# This has no effect if the `fail` arg is set to `false`.
threshold: 90
# Fail the workflow if the minimum code coverage
# reuqirements are not satisfied.
fail: false
# Publish the rendered output as a PR comment
publish: true
# Create a coverage diff report.
diff: true
# Branch to diff against.
# Compare the current coverage to the coverage
# determined on this branch.
diff-branch: master
# This is where the coverage reports for the
# `diff-branch` are stored.
# Branch is created if it doesn't already exist'.
# diff-storage: _xml_coverage_reports
coverage-summary-title: "Code Coverage Summary"
new-uncovered-statements-failure: true
# new-uncovered-statements-failure: true
simulate-tests:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout
uses: actions/checkout@v4
- name: Setup Nodejs
uses: actions/setup-node@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
./simulate-tests/node_modules/
key: ${{ runner.os }}-yarn-${{ hashFiles('./simulate-tests/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
npm install -g yarn
cd simulate-tests
yarn
- name: Run test
run: |
cd simulate-tests
yarn test