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

add gas-test report #5

Merged
merged 16 commits into from
May 29, 2024
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

test:
needs: setup
uses: ./.github/workflows/test.yml
uses: ./.github/workflows/gas-test.yml

slither-test:
needs: setup
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/gas-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Gas Test

on:
workflow_call:

jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.9.0

- name: Restore node modules cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: Run tests
run: npx hardhat test
env:
BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }}
CMC_API_KEY: ${{ secrets.CMC_API_KEY }}

- name: Check if gasReport.md exists
id: check_gas_report
run: |
if [ -f gasReport.md ]; then
echo "exists=true" >> $GITHUB_ENV
else
echo "exists=false" >> $GITHUB_ENV
fi

- name: Comment on pull request
if: env.exists == 'true'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: gasReport.md
comment_tag: 'gas_report'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/slither-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
- name: Checkout code from caller repo
uses: actions/checkout@v4

- name: Checkout shared workflows repository
- name: Checkout solidity workflows repository
uses: actions/checkout@v4
with:
repository: The-Poolz/shared-workflows
repository: The-Poolz/solidity-workflows
ref: master
path: shared-workflows
path: solidity-workflows

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
REPORT: ${{ steps.slither.outputs.stdout }}
with:
script: |
const script = require('./shared-workflows/.github/scripts/comment')
const script = require('./solidity-workflows/.github/scripts/comment')
const header = '# Slither report'
const body = process.env.REPORT
await script({ github, context, header, body })
27 changes: 0 additions & 27 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@


## License
This project is licensed under the [MIT License](https://github.com/The-Poolz/shared-workflows/blob/master/LICENSE).
This project is licensed under the [MIT License](https://github.com/The-Poolz/solidity-workflows/blob/master/LICENSE).