テスト実行とガスレポートをGitHub Actionsに #4
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
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 dependencies | |
run: npm install | |
working-directory: ./pkgs/contract | |
- name: Run Hardhat tests | |
run: npx hardhat test | |
working-directory: ./pkgs/contract | |
env: | |
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" | |
# ガスレポートをアーティファクトとして保存 | |
- name: Upload Gas Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gas-report | |
path: ./pkgs/contract/gas-report.txt |