README.md #80
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: Hardhat Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_and_test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Node.js versions | |
node-version: [18, 20] | |
# Hardhat releases: https://github.com/NomicFoundation/hardhat/releases | |
hardhat-version: [2.22] # Keep ONLY ONE version. | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Init NPM Project | |
run: npm init -y | |
- name: Install Hardhat | |
run: npm install --save-dev hardhat@${{ matrix.hardhat-version }} | |
- name: Install NPM Dependencies | |
run: npm install | |
- name: Compile Hardhat Contracts | |
run: npx hardhat compile | |
- name: Debug Environment | |
run: | | |
echo "Current directory: $(pwd)" | |
echo "PATH: $PATH" | |
echo "Hardhat version: $(npx hardhat --version)" | |
echo "Node.js version: $(node --version)" | |
echo "Solidity version: $(npx hardhat run scripts/getSolidityVersion.ts)" | |
- name: Run Hardhat Tests | |
run: npx hardhat test | |
- name: Run Gas Reporter | |
run: npx hardhat test | |
env: | |
REPORT_GAS: true |