chore: separate test workflow for each package #21
Workflow file for this run
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: Run Tests for Core | |
on: pull_request | |
jobs: | |
test-core: | |
runs-on: ubuntu-latest | |
services: | |
evm-node-1: | |
image: ghcr.io/foundry-rs/foundry | |
ports: | |
- "8545:8545" | |
options: >- | |
--entrypoint "anvil --port 8545 --host 0.0.0.0" | |
evm-node-2: | |
image: ghcr.io/foundry-rs/foundry | |
ports: | |
- "8546:8546" | |
options: >- | |
--entrypoint "anvil --port 8546 --host 0.0.0.0" | |
steps: | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Output evm-node-1 logs | |
run: | | |
CONTAINER_ID=$(docker ps -q --filter "ancestor=ghcr.io/foundry-rs/foundry" --filter "publish=8545") | |
if [ -n "$CONTAINER_ID" ]; then | |
docker logs $CONTAINER_ID | |
else | |
echo "evm-node-1 container is not running" | |
exit 1 | |
fi | |
- name: Output evm-node-2 logs | |
run: | | |
CONTAINER_ID=$(docker ps -q --filter "ancestor=ghcr.io/foundry-rs/foundry" --filter "publish=8546") | |
if [ -n "$CONTAINER_ID" ]; then | |
docker logs $CONTAINER_ID | |
else | |
echo "evm-node-2 container is not running" | |
exit 1 | |
fi | |
- name: Check if evm-node-1 is running | |
run: | | |
curl -sSf http://localhost:8545 || { echo "evm-node-1 is not running"; exit 1; } | |
- name: Check if evm-node-2 is running | |
run: | | |
curl -sSf http://localhost:8546 || { echo "evm-node-2 is not running"; exit 1; } | |
- name: Build | |
run: npm run build:core | |
- name: Test | |
timeout-minutes: 15 | |
run: | | |
npm run test:core |