-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
4,670 additions
and
3,766 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = async ({ github, context, header, body }) => { | ||
const comment = [header, body].join('\n') | ||
|
||
const { data: comments } = await github.rest.issues.listComments({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.payload.number | ||
}) | ||
|
||
const botComment = comments.find( | ||
(comment) => | ||
// github-actions bot user | ||
comment.user.id === 41898282 && comment.body.startsWith(header) | ||
) | ||
|
||
const commentFn = botComment ? 'updateComment' : 'createComment' | ||
|
||
await github.rest.issues[commentFn]({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: comment, | ||
...(botComment ? { comment_id: botComment.id } : { issue_number: context.payload.number }) | ||
}) | ||
} |
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 |
---|---|---|
|
@@ -6,11 +6,8 @@ on: | |
|
||
jobs: | ||
eslint: | ||
name: eslint | ||
name: ESLint | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
@@ -27,3 +24,112 @@ jobs: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reporter: github-pr-check | ||
filter_mode: nofilter | ||
prettier: | ||
name: Prettier | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
- uses: EPMatt/reviewdog-action-prettier@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-check | ||
filter_mode: nofilter | ||
prettier_flags: "**/*.{js,sol,ts,json,jsx,tsx}" | ||
solhint: | ||
name: Solhint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Setup reviewdog | ||
uses: reviewdog/action-setup@v1 | ||
with: | ||
reviewdog_version: latest | ||
- name: Run solhint | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npx solhint -f sarif 'contracts/**/*.sol' | reviewdog -f=sarif -reporter=github-pr-check -level=error -fail-level=none -filter-mode=nofilter -name=solhint | ||
coverage: | ||
name: Coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 1000 | ||
- name: Fetch base | ||
run: git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1000 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run coverage | ||
run: SOLIDITY_COVERAGE=true npx hardhat coverage | ||
- name: Setup LCOV | ||
uses: hrishikesh-kadam/setup-lcov@v1 | ||
- name: Report code coverage | ||
uses: zgosalvez/github-actions-report-lcov@v3 | ||
with: | ||
coverage-files: coverage/lcov.info | ||
minimum-coverage: 90 | ||
artifact-name: code-coverage-report | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: . | ||
update-comment: true | ||
slither: | ||
name: Slither | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup reviewdog | ||
uses: reviewdog/action-setup@v1 | ||
with: | ||
reviewdog_version: latest | ||
- name: Run Slither | ||
uses: crytic/[email protected] | ||
id: slither | ||
with: | ||
node-version: 20 | ||
sarif: "sarif.json" | ||
fail-on: none | ||
slither-args: --filter-paths node_modules/ --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/ | ||
- name: Create/update checklist as PR comment | ||
uses: actions/github-script@v7 | ||
if: ${{ (success() || failure()) && 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 }) | ||
- name: Run reviewdog | ||
if: ${{ success() || failure() }} | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cat sarif.json | ||
cat sarif.json | reviewdog -f=sarif -reporter=github-pr-check -filter-mode=nofilter -level=error -fail-level=none -name=slither | ||
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
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,3 +1,6 @@ | ||
{ | ||
"extends": "solhint:recommended" | ||
} | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"func-visibility": ["warn", { "ignoreConstructors": true }] | ||
} | ||
} |
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,19 +1,17 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"hbenl.vscode-mocha-test-adapter", | ||
"esbenp.prettier-vscode", | ||
"JuanBlanco.solidity", | ||
"ms-vscode.test-adapter-converter", | ||
"hbenl.vscode-test-explorer", | ||
"mhutchie.git-graph" | ||
], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [ | ||
"NomicFoundation.hardhat-solidity" | ||
] | ||
} | ||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"hbenl.vscode-mocha-test-adapter", | ||
"esbenp.prettier-vscode", | ||
"JuanBlanco.solidity", | ||
"ms-vscode.test-adapter-converter", | ||
"hbenl.vscode-test-explorer", | ||
"mhutchie.git-graph" | ||
], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": ["NomicFoundation.hardhat-solidity"] | ||
} |
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
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
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
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
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
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
Oops, something went wrong.