Skip to content

Eldritch v2

Eldritch v2 #12

Workflow file for this run

name: E2E Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Install Protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler jq
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Frontend
working-directory: tavern/internal/www
run: |
npm install
npm run build
- name: Install Playwright
working-directory: tests/e2e
run: |
npm install
npx playwright install --with-deps
- name: Build dependencies
run: |
go mod download
cd implants/imixv2 && cargo fetch
- name: Run E2E Test
run: |
# Start Tavern
echo "Starting Tavern..."
HTTP_LISTEN_ADDR=:8000 go run ./tavern &
TAVERN_PID=$!
# Wait for Tavern to be ready
echo "Waiting for Tavern..."
timeout 60s bash -c 'until curl -s localhost:8000/status > /dev/null; do sleep 1; done'
# Get Pubkey
PUBKEY=$(curl -s localhost:8000/status | jq -r .Pubkey)
echo "Retrieved Pubkey: $PUBKEY"
if [ -z "$PUBKEY" ] || [ "$PUBKEY" == "null" ]; then
echo "Failed to retrieve pubkey"
exit 1
fi
# Start Imix
echo "Starting Imixv2..."
cd implants/imixv2
export IMIX_SERVER_PUBKEY=$PUBKEY
# Redirect output to log file to check startup
cargo run > imix.log 2>&1 &
IMIX_PID=$!
cd ../..
# Wait for Imix to start (compilation might take time)
echo "Waiting for Imix to start (compilation in progress)..."
# We search for "Starting imixv2 agent" in the log
if ! timeout 600s bash -c 'until grep -q "Starting imixv2 agent" implants/imixv2/imix.log; do sleep 2; done'; then
echo "Imix failed to start or timed out."
cat implants/imixv2/imix.log
kill $IMIX_PID || true
kill $TAVERN_PID || true
exit 1
fi
echo "Imix started."
# Optional: show imix logs in background tail
tail -f implants/imixv2/imix.log &
# Run Playwright
echo "Running Playwright Tests..."
cd tests/e2e
# Increase default timeout just in case
npx playwright test
# Cleanup
kill $IMIX_PID || true
kill $TAVERN_PID || true