Skip to content

chore: separate test workflow for each package #14

chore: separate test workflow for each package

chore: separate test workflow for each package #14

Workflow file for this run

name: Run Tests for Core
on: pull_request
jobs:
test-core:
runs-on: ${{ matrix.os }}
container: ubuntu
strategy:
matrix:
os: [ubuntu-22.04]
arch: [amd64]
# Elasticsearch used by MultiversX test
services:
evm-node-1:
image: ghcr.io/foundry-rs/foundry
ports:
- "8545:8545"
options: >-
--expose 8545
--entrypoint anvil --host 0.0.0.0 -p 8545
evm-node-2:
image: ghcr.io/foundry-rs/foundry
ports:
- "8546:8546"
options: >-
--expose 8546
--entrypoint anvil --host 0.0.0.0 -p 8546
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: Build
run: npm run build:core
- name: Test
timeout-minutes: 15
run: |
apt-get update
apt-get install curl -y
echo "Checking EVM node 1 (8545)"
curl -v -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:8545
echo "\n\nChecking EVM node 2 (8546)"
curl -v -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:8546
echo "\n\nTrying with 127.0.0.1 instead of localhost"
curl -v -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://127.0.0.1:8545
echo "\n\nChecking if curl can reach other services"
curl -v http://example.com
echo "\n\nDocker logs for Anvil containers"
docker logs $(docker ps -q --filter "ancestor=ghcr.io/foundry-rs/foundry:latest")
echo "\n\nRunning tests"
# curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://127.0.0.1:8545
npm run test:core