Skip to content

Monitoring of nodes using prometheus #19

Monitoring of nodes using prometheus

Monitoring of nodes using prometheus #19

Workflow file for this run

name: E2E Tests
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- 'docs/**'
jobs:
build:
name: Build Application and UI
runs-on: ubuntu-latest
services:
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.4'
cache: true
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Build UI
run: |
cd web
bun install
export API_URL="/api"
bun run build
- name: Install dependencies
run: |
go mod download
sudo apt-get update
sudo apt-get install -y build-essential
- name: Build the application
run: |
go build -v -o chainlaunch ./main.go
chmod +x chainlaunch
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
chainlaunch
web/dist
testnet-besu:
name: Create Besu Testnet
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Start the application and run API tests
run: |
export CHAINLAUNCH_USER=admin
export CHAINLAUNCH_PASSWORD=admin123
export CHAINLAUNCH_DATA=${{ github.workspace }}/test-data
echo "CHAINLAUNCH_DATA: $CHAINLAUNCH_DATA"
chmod +x chainlaunch
./chainlaunch serve --data=$CHAINLAUNCH_DATA --port=8100 --db data.db &
# Wait for port 8100 to be available (60 seconds timeout)
timeout=60
while ! curl -s http://localhost:8100 > /dev/null; do
if [ $timeout -le 0 ]; then
echo "Timeout waiting for API to become available"
exit 1
fi
echo "Waiting for API to become available... ($timeout seconds remaining)"
sleep 1
timeout=$((timeout - 1))
done
- name: Create Besu testnet
run: |
chmod +x chainlaunch
./chainlaunch testnet besu --name mynet --nodes 4 --prefix besu-test --mode=docker
- name: Wait for Besu block number >= 5
run: |
for i in {1..90}; do
resp=$(curl -s -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545)
block_hex=$(echo "$resp" | jq -r .result)
if [ "$block_hex" != "null" ]; then
block_num=$((16#${block_hex:2}))
echo "Current block: $block_num"
if [ "$block_num" -ge 5 ]; then
echo "Besu node has reached block >= 5"
exit 0
fi
fi
sleep 1
done
echo "Timeout: Besu node did not reach block >= 5 in 90 seconds"
exit 1
testnet-fabric:
name: Create Fabric Testnet
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Create Fabric testnet (placeholder)
run: |
echo "Fabric testnet creation step - to be implemented"
api-e2e:
name: Run API E2E Tests
runs-on: ubuntu-latest
needs: [build, testnet-besu, testnet-fabric]
services:
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
env:
API_BASE_URL: http://localhost:8100/api/v1
CHAINLAUNCH_USER: admin
CHAINLAUNCH_PASSWORD: admin123
API_USERNAME: admin
API_PASSWORD: admin123
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Start the application and run API tests
run: |
export CHAINLAUNCH_USER=admin
export CHAINLAUNCH_PASSWORD=admin123
export CHAINLAUNCH_DATA=${{ github.workspace }}/test-data
echo "CHAINLAUNCH_DATA: $CHAINLAUNCH_DATA"
chmod +x chainlaunch
./chainlaunch serve --data=$CHAINLAUNCH_DATA --port=8100 --db data.db &
# Wait for port 8100 to be available (60 seconds timeout)
timeout=60
while ! curl -s http://localhost:8100 > /dev/null; do
if [ $timeout -le 0 ]; then
echo "Timeout waiting for API to become available"
exit 1
fi
echo "Waiting for API to become available... ($timeout seconds remaining)"
sleep 1
timeout=$((timeout - 1))
done
- name: Upload API test results
if: always()
uses: actions/upload-artifact@v4
with:
name: api-test-results
path: test-results.xml
ui-e2e:
name: Run UI E2E Tests
runs-on: ubuntu-latest
needs: build
services:
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
env:
CYPRESS_BASE_URL: http://localhost:8100
CYPRESS_API_URL: http://localhost:8100/api/v1
PLAYWRIGHT_USER: admin
PLAYWRIGHT_PASSWORD: admin123
CHAINLAUNCH_USER: admin
CHAINLAUNCH_PASSWORD: admin123
PLAYWRIGHT_BASE_URL: http://localhost:8100
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('web/package.json', 'web/bun.lockb') }}
restore-keys: |
playwright-browsers-${{ runner.os }}-
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Build UI
run: |
cd web
bun install
- name: Install Playwright Browsers
run: |
cd web
bunx playwright install --with-deps
- name: Start server and run UI tests
run: |
export CHAINLAUNCH_DATA=${{ github.workspace }}/test-data
chmod +x chainlaunch
./chainlaunch serve --data=$CHAINLAUNCH_DATA --port=8100 --db data.db &
# Wait for port 8100 to be available (60 seconds timeout)
timeout=60
while ! curl -s http://localhost:8100 > /dev/null; do
if [ $timeout -le 0 ]; then
echo "Timeout waiting for API to become available"
exit 1
fi
echo "Waiting for API to become available... ($timeout seconds remaining)"
sleep 1
timeout=$((timeout - 1))
done
cd web
bun run test:e2e
- name: Upload UI test results
if: always()
uses: actions/upload-artifact@v4
with:
name: ui-test-results
path: |
web/test-results