Skip to content

Commit

Permalink
dev: Gas metering (#319)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->

Adds a gas_report for the PRs in Github Actions!
If the gas increases, the PR check will fail. If the gas decreases or
remains same, the PR check passes!

<!-- Please try to limit your pull request to one type; submit multiple
pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build-related changes
- [ ] Documentation content changes
- [x] Other (please describe): Github Action job 

## What is the current behavior?

There is no tracing of gas usage in PRs!
Issue Number: #292 

## What is the new behavior?

When the PR is made, the gas_report is generated and compared with the
pre-existing one to trace the gas usage in tests. If more gas is being
used, the PR check fails, and has to be manually accepted after
checking! If the gas usage remains same, or decreases, the PR passes!

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this does introduce a breaking change, please describe the
impact and migration path for existing applications below. -->
  • Loading branch information
harsh-ps-2003 authored Jul 25, 2024
1 parent 0aa7cca commit bcdca70
Show file tree
Hide file tree
Showing 3 changed files with 710 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ jobs:
uses: software-mansion/[email protected]
- name: Step 3 - Checking formatting
run: scarb fmt --check

gas-report:
needs: test
name: gas-report
runs-on: ubuntu-latest
steps:
- name: Step 1 - Check out main branch
uses: actions/checkout@v3
- name: Step 2 - Getting scarb
uses: software-mansion/[email protected]
- name: Step 3 - Generate and compare gas report
run: ./scripts/generate_gas_report.sh
shell: bash
Loading

0 comments on commit bcdca70

Please sign in to comment.