Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implements two gas reports, one for unit tests, and another for prod tests #805

Merged
merged 6 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ commands:
- fork_start:
network: << parameters.network >>
reset: true
- run: npm run test:prod:gas
- run: npm run test:prod:gas && npx codechecks codechecks.prod.yml
testnet_pvt:
description: Run testnet PVT
parameters:
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- checkout
- attach_workspace:
at: .
- run: npm run test:gas && npx codechecks
- run: npm run test:gas && npx codechecks codechecks.unit.yml
working_directory: ~/repo
lint:
docker:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/commands/fork_test_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ steps:
- fork_start:
network: << parameters.network >>
reset: true
- run: npm run test:prod:gas
- run: npm run test:prod:gas && npx codechecks codechecks.prod.yml
2 changes: 1 addition & 1 deletion .circleci/src/jobs/gas-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ steps:
- checkout
- attach_workspace:
at: .
- run: npm run test:gas && npx codechecks
- run: npm run test:gas && npx codechecks codechecks.unit.yml
1 change: 1 addition & 0 deletions buidler.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ module.exports = {
enabled: false,
showTimeSpent: true,
currency: 'USD',
maxMethodDiff: 25, // CI will fail if gas usage is > than this %
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we override this failure if the expected gas usage is going to be more than 25% (something that can't be optimised for example the recent exchange updates for debt snapshot might increase it by more than 25% ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that in those cases, the percentage is incremented in the PR, but it has to be done consciously, and that's the whole point. After merge, another PR could lower the percentage again.

outputFile: 'test-gas-used.log',
},
};
2 changes: 2 additions & 0 deletions codechecks.yml → codechecks.prod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
checks:
- name: eth-gas-reporter/codechecks
options:
name: prod-test-gas-report
settings:
branches:
- develop
Expand Down
8 changes: 8 additions & 0 deletions codechecks.unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
checks:
- name: eth-gas-reporter/codechecks
options:
name: unit-test-gas-report
settings:
branches:
- develop
- master
40 changes: 23 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"axios": "0.19.2",
"bn.js": "4.11.8",
"buidler-ast-doc": "0.0.14-rc",
"buidler-gas-reporter": "^0.1.4-beta.3",
"buidler-gas-reporter": "^0.1.4",
"chai": "4.2.0",
"chalk": "^2.4.2",
"concurrently": "5.2.0",
Expand Down