Skip to content

Zy0n/7702 base main #340

Zy0n/7702 base main

Zy0n/7702 base main #340

name: Integration Tests (V2)
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
integration-tests:
name: 🧪 Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: '22'
- name: Checkout engine repo
uses: actions/checkout@v3
with:
path: engine
- name: Checkout contract repo
uses: actions/checkout@v3
with:
repository: Railgun-Privacy/contract
path: contract
- name: Enable Corepack
run: corepack enable
- name: Yarn in engine
working-directory: ./engine
run: yarn install --frozen-lockfile
- name: Yarn in contract
working-directory: ./contract
run: yarn install --frozen-lockfile
- name: Build contract
working-directory: ./contract
run: npm run compile
- name: Start Hardhat node (background)
working-directory: ./contract
run: |
npm run node > "$GITHUB_WORKSPACE/hardhat.log" 2>&1 &
echo $! > "$GITHUB_WORKSPACE/hardhat.pid"
for i in {1..120}; do
if curl -s -o /dev/null -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \
http://localhost:8545; then
echo "Hardhat node ready"
exit 0
fi
sleep 1
done
echo "Hardhat node did not become ready in 120s"
cat "$GITHUB_WORKSPACE/hardhat.log"
exit 1
- name: Deploy contracts
working-directory: ./contract
run: npm run deploy
- name: Run engine tests
working-directory: ./engine
run: yarn test-hardhat-V2
- name: Stop Hardhat node
if: always()
run: |
if [ -f "$GITHUB_WORKSPACE/hardhat.pid" ]; then
kill "$(cat "$GITHUB_WORKSPACE/hardhat.pid")" 2>/dev/null || true
fi