Issue/198 aowheel #207
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 Yarn | |
run: npm install -g yarn | |
- name: Install dependencies | |
run: yarn 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}" |