-
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 #108 from hackdays-io/gactions
テスト実行とガスレポートをGitHub Actionsに
- Loading branch information
Showing
5 changed files
with
12,068 additions
and
258 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,58 @@ | ||
name: Test Contracts | ||
|
||
on: | ||
# mainブランチにプッシュされたとき、またはプルリクエストが作成されたときに実行 | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install Yarn | ||
run: npm install -g yarn | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
working-directory: ./pkgs/contract | ||
|
||
- name: Run Hardhat tests | ||
run: | | ||
npx hardhat test > ./test-results.txt | ||
echo "\`\`\`\n$(cat ./test-results.txt)" > ./comments | ||
working-directory: ./pkgs/contract | ||
env: | ||
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" | ||
|
||
- name: Generate Gas Report | ||
run: | | ||
npx hardhat test --network hardhat > ./gas-report.txt | ||
echo "\n### Gas Report" >> ./comments | ||
echo "\`\`\`\n$(cat ./gas-report.txt)" >> ./comments | ||
working-directory: ./pkgs/contract | ||
|
||
- name: Upload Gas Report as Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: gas-report | ||
path: ./pkgs/contract/gas-report.txt | ||
|
||
# GitHub PRにテスト結果とガスレポートをコメントとして投稿 | ||
- name: Post comments | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
URL: ${{ github.event.pull_request.html_url }} | ||
run: gh pr comment -F ./comments "${URL}" |
Oops, something went wrong.