Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unstoppabledomains/solidity-sizer
https://github.com/unstoppabledomains/solidity-sizer
Last synced: about 4 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/unstoppabledomains/solidity-sizer
- Owner: unstoppabledomains
- Created: 2022-09-19T14:35:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-22T10:39:53.000Z (about 2 years ago)
- Last Synced: 2024-10-02T17:31:15.372Z (about 1 month ago)
- Language: TypeScript
- Size: 139 KB
- Stars: 2
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-solidity - solidity-sizer - GitHub Action that adds a comment to the PR indicating the size of contracts, including size differences. (Tools)
- awesome-solidity - solidity-sizer - GitHub Action that adds a comment to the PR indicating the size of contracts, including size differences. (Tools)
README
# solidity-sizer
A GitHub action that comments the pull request with the size of the Solidity
contracts.## Usage
### Contracts size and delta
hardhat size-contracts doesn't support git based delta calculation, it uses
cache/.hardhat_contract_sizer_output.json to store contracts size data and then
just compare new results against this file to get delta.So, we need two jobs to get the delta between the source and target branches:
- `target-contracts-size` will checkout the target branch, run hardhat
size-contracts and put `cache/.hardhat_contract_sizer_output.json` into the
artifacts.
- `pr-contracts-size` will checkout the source branch, download artifacts and
run solidity-sizer which will calculate the delta using
`hardhat_contract_sizer_output.json` from `target-contracts-size````yml
on: pull_requestjobs:
target-contracts-size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.ref }}
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn install
- run: yarn compile:size
- uses: actions/upload-artifact@v3
with:
name: hardhat-contract-sizer-output
path: cache/.hardhat_contract_sizer_output.jsonpr-contracts-size:
runs-on: ubuntu-latest
needs: target-contracts-size
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn install
- uses: actions/download-artifact@v3
with:
name: hardhat-contract-sizer-output
path: cache/
- uses: unstoppabledomains/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```### Only contracts size
```yml
on: pull_request
contracts-size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn install
- uses: actions/download-artifact@v3
with:
name: hardhat-contract-sizer-output
path: cache/
- uses: unstoppabledomains/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```## Inputs
### Action inputs
| Name | Description | Required | Default |
| -------------- | -------------------------------------------- | -------- | ------------------------------- |
| `GITHUB_TOKEN` | Token that is used to create comment | ✅ | |
| `command` | Command that will run hardhat size-contracts | | yarn run hardhat size-contracts |