datahaven/.github/workflows/task-moonwall-tests.yml
Ahmad Kaouk 17c706dc64
test: Integrate moonwall (#185)
### Description

This PR introduces the **Moonwall** end-to-end (E2E) testing framework.
The primary motivation for this is to enable the porting of existing
Mobeam tests into the `DataHaven` repository.

### Key Changes

*   **Node Manual Sealing:**
* Introduced a `--sealing=manual` flag for the `datahaven-node`. When
enabled, blocks are only produced on demand via an RPC call. This is the
core mechanism that allows for deterministic tests.

*   **Moonwall Framework Integration:**
* Added `@moonwall/cli` and `@moonwall/util` dependencies to the
`test/package.json`.
* A new `test/moonwall.config.json` file configures the test
environment, defining how Moonwall should launch the `datahaven-node`
with the manual sealing flag.
* Added a `moonwall:test` script to `package.json` for running the
tests.

*   **CI Workflow:**
* A new reusable workflow, `.github/workflows/task-moonwall-tests.yml`,
has been created to handle the setup, execution, and reporting of
Moonwall tests.
* The main `CI.yml` now includes a `moonwall-tests` job that runs after
the `build-operator` job, ensuring it always tests the correct,
freshly-built binary.

*   **Example Test Suite:**
* A new test suite, `test/datahaven/suites/dev/test-block.ts`, had been
copied from moonbeam.

### How to Run Locally

1.  Navigate to the `test` directory.
2.  Install dependencies: `bun install`
3.  Run the tests: `bun run moonwall:test`

---------

Co-authored-by: undercover-cactus <lola@moonsonglabs.com>
2025-09-30 14:47:39 +00:00

70 lines
2 KiB
YAML

name: Moonwall Tests
on:
workflow_dispatch:
workflow_call:
inputs:
binary-hash:
description: "Hash of the built operator binary uploaded as artifact"
required: true
type: string
jobs:
moonwall:
runs-on: ubuntu-latest
defaults:
run:
working-directory: test
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download operator binary artifact
uses: actions/download-artifact@v4
with:
name: datahaven-node-${{ inputs.binary-hash }}
path: operator/target/x86_64-unknown-linux-gnu/release
- name: Prepare operator binary in expected path
run: |
mkdir -p ../operator/target/release
cp ../operator/target/x86_64-unknown-linux-gnu/release/datahaven-node ../operator/target/release/datahaven-node
chmod +x ../operator/target/release/datahaven-node
timeout 20 ../operator/target/release/datahaven-node \
--dev \
--no-telemetry \
--unsafe-force-node-key-generation \
--reserved-only \
--no-grandpa \
--no-prometheus \
--sealing=manual 2>&1 | head -50 || echo "Node startup test completed"
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
run: bun install
- name: Run Moonwall tests
run: bun run moonwall:test
- name: Upload Moonwall reports
if: always()
uses: actions/upload-artifact@v4
with:
name: moonwall-reports
path: |
test/tmp/testResults.json
test/reports/**
test/**/*.log
retention-days: 1