-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from The-Poolz/issue-82
add `reusable workflows` to helper
- Loading branch information
Showing
17 changed files
with
7,281 additions
and
10,712 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,16 @@ | ||
name: Build and Test | ||
name: CI for Solidity Contracts | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
Setup: | ||
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: Cache node modules | ||
uses: actions/cache@v4 | ||
id: npm-cache | ||
with: | ||
path: | | ||
node_modules | ||
~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.npm-cache.outputs.cache-hit != 'true' | ||
run: npm i | ||
|
||
Test: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' # This line ensures that this job only runs on pull requests | ||
needs: Setup | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.9.0" | ||
|
||
- name: Cache node modules | ||
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 | ||
|
||
Slither-Test: | ||
runs-on: ubuntu-latest | ||
needs: Setup | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.9.0" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
node_modules | ||
~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Run Slither | ||
uses: crytic/slither-action@v0.3.2 | ||
id: slither | ||
with: | ||
node-version: "20.9.0" | ||
fail-on: high | ||
slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/ | ||
|
||
- name: Create/update checklist as PR comment | ||
uses: actions/github-script@v7 | ||
if: github.event_name == 'pull_request' | ||
env: | ||
REPORT: ${{ steps.slither.outputs.stdout }} | ||
with: | ||
script: | | ||
const script = require('.github/scripts/comment') | ||
const header = '# Slither report' | ||
const body = process.env.REPORT | ||
await script({ github, context, header, body }) | ||
Coverage-Test: | ||
runs-on: ubuntu-latest | ||
needs: Setup | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.9.0" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
node_modules | ||
~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Run tests and generate coverage | ||
run: npx hardhat coverage | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # required | ||
build: | ||
uses: The-Poolz/solidity-workflows/.github/workflows/build.yml@v0.6.0 | ||
secrets: | ||
codecov_token: ${{ secrets.CODECOV_TOKEN }} | ||
bscscan_api_key: ${{ secrets.BSCSCAN_API_KEY }} | ||
cmc_api_key: ${{ secrets.CMC_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ artifacts | |
typechain | ||
typechain-types | ||
dist | ||
gasReport.md | ||
|
||
# production | ||
build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ coverage.json | |
cache | ||
artifacts | ||
typechain | ||
typechain-types | ||
typechain-types | ||
gasReport.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,48 @@ | ||
import '@nomicfoundation/hardhat-toolbox'; | ||
import 'hardhat-gas-reporter'; | ||
import { HardhatUserConfig } from 'hardhat/config'; | ||
import 'solidity-coverage'; | ||
import { HardhatUserConfig } from "hardhat/config" | ||
import "hardhat-gas-reporter" | ||
import "@typechain/hardhat" | ||
import "solidity-coverage" | ||
import "@nomicfoundation/hardhat-network-helpers" | ||
import "@nomicfoundation/hardhat-chai-matchers" | ||
|
||
const config: HardhatUserConfig = { | ||
defaultNetwork: 'hardhat', | ||
solidity: { | ||
version: '0.8.24', | ||
settings: { | ||
evmVersion: 'istanbul', | ||
optimizer: { | ||
enabled: true, | ||
runs: 200, | ||
}, | ||
defaultNetwork: "hardhat", | ||
solidity: { | ||
compilers: [ | ||
{ | ||
version: "0.8.27", | ||
settings: { | ||
evmVersion: "istanbul", | ||
optimizer: { | ||
enabled: true, | ||
runs: 200, | ||
}, | ||
viaIR: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
networks: { | ||
hardhat: { | ||
blockGasLimit: 130_000_000, | ||
}, | ||
}, | ||
}, | ||
networks: { | ||
hardhat: { | ||
blockGasLimit: 130_000_000, | ||
gasReporter: { | ||
enabled: true, | ||
showMethodSig: true, | ||
currency: "USD", | ||
token: "BNB", | ||
gasPriceApi: | ||
"https://api.bscscan.com/api?module=proxy&action=eth_gasPrice&apikey=" + process.env.BSCSCAN_API_KEY, | ||
coinmarketcap: process.env.CMC_API_KEY || "", | ||
noColors: true, | ||
reportFormat: "markdown", | ||
outputFile: "gasReport.md", | ||
forceTerminalOutput: true, | ||
L1: "binance", | ||
forceTerminalOutputFormat: "terminal", | ||
showTimeSpent: true, | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
export default config; | ||
export default config |
Oops, something went wrong.