Merge branch 'main' of github.com:bobanetwork/aa-hc-example #49
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: Smart Contract Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
name: Forge and Hardhat Tests | |
runs-on: ubuntu-latest | |
environment: tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
- name: Install Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Install Rust and Cargo | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Make | |
run: sudo apt-get install -y make | |
- name: Install dependencies (root) | |
run: pnpm install | |
- name: Install dependencies (contracts) | |
run: pnpm install | |
working-directory: ./contracts | |
- name: Run Forge tests | |
run: forge test -vvv | |
working-directory: ./contracts | |
- name: Start local environment | |
# timeout 5000 | |
run: | | |
pnpm start:local 2>&1 | tee local_env.log | |
continue-on-error: true | |
id: start_local | |
env: | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} # needed for hardhat.config to compile | |
CONRANKING_API_KEY: ${{ secrets.CONRANKING_API_KEY }} # for backend | |
- name: Check start local environment status | |
if: steps.start_local.outcome == 'failure' | |
run: | | |
echo "Local environment failed to start or timed out after 20 minutes" | |
cat local_env.log | |
exit 1 | |
- name: Run Hardhat tests | |
if: steps.start_local.outcome == 'success' | |
run: npx hardhat test | |
working-directory: ./contracts | |
env: | |
TOKEN_PRICE_CONTRACT: ${{ vars.TOKEN_PRICE_CONTRACT }} | |
RPC_URL: ${{ vars.RPC_URL }} | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
- name: Display full logs | |
if: always() | |
run: cat local_env.log |