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

Feature/implement cario coverage & increase coverage #6

Merged
merged 26 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
16 changes: 16 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ jobs:
- uses: asdf-vm/actions/install@v3
- run: scarb test
working-directory: contracts

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- run: curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh

- name: Run tests and generate report
run: cd contracts/ && snforge test --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.lcov
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
contracts/target
contracts/.snfoundry_cache/

# snforge --coverage
contracts/.snfoundry_versioned_programs
contracts/snfoundry_trace
contracts/coverage

# `mac`
**/.DS_Store
6 changes: 6 additions & 0 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ name = "kudos"
version = "0.1.0"
edition = "2024_07"

[cairo]
unstable-add-statements-code-locations-debug-info = true
unstable-add-statements-functions-debug-info = true
inlining-strategy = "avoid"

[scripts]
test = "snforge test"
coverage = "snforge test --coverage"

[tool.fmt]
sort-module-level-items = true
Expand Down
5 changes: 0 additions & 5 deletions contracts/src/kudos.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,5 @@ pub mod Kudos {
fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {
self.erc20.balance_of(account)
}
fn allowance(
self: @ContractState, owner: ContractAddress, spender: ContractAddress
) -> u256 {
self.erc20.allowance(owner, spender)
}
}
}
Loading