From c6fd9e6eb150625eab9b47bdda659aad3b4275e3 Mon Sep 17 00:00:00 2001 From: tomyrd Date: Mon, 28 Oct 2024 13:30:38 -0300 Subject: [PATCH] feat: add CI integration test with prover --- .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ Makefile | 24 ++++++++++++++++++++++++ crates/web-client/package.json | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 67fb87351..08cfc519c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,3 +58,30 @@ jobs: - name: Kill miden-node if: always() run: make kill-node + + remote_prover_integration_tests_web_client: + name: integration_tests_web_client + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - name: Install Rust + run: | + rustup update --no-self-update + rustup target add wasm32-unknown-unknown + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + - run: make clean-node + - run: make node + - run: make start-node > /dev/null & + - run: make clean-prover + - run: make prover + - run: make start-prover > /dev/null & + - run: make prover-integration-test-web-client + - name: Kill miden-node + if: always() + run: make kill-node + - name: Kill miden-prover + if: always() + run: make kill-prover diff --git a/Makefile b/Makefile index b05d94d2a..65ed765a9 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ FEATURES_CLI=--features "testing, concurrent" NODE_FEATURES_TESTING=--features "testing" WARNINGS=RUSTDOCFLAGS="-D warnings" NODE_BRANCH="next" +PROVER_BRANCH="tomyrd-lazy-remote-prover-connection" +PROVER_FEATURES_TESTING=--features "testing" # --- Linting ------------------------------------------------------------------------------------- @@ -84,6 +86,10 @@ integration-test: ## Run integration tests integration-test-web-client: ## Run integration tests for the web client cd ./crates/web-client && npm run test:clean +.PHONY: prover-integration-test-web-client +prover-integration-test-web-client: ## Run integration tests for the web client with remote prover + cd ./crates/web-client && npm run test:remote_prover + .PHONY: integration-test-full integration-test-full: ## Run the integration test binary with ignored tests included cargo nextest run --workspace --exclude miden-client-web --release --test=integration $(FEATURES_CLI) @@ -108,6 +114,24 @@ node: ## Setup node directory start-node: ## Run node. This requires the node repo to be present at `miden-node` cd miden-node && cargo run --bin miden-node $(NODE_FEATURES_TESTING) -- start --config ../tests/config/miden-node.toml node +.PHONY: clean-prover +clean-prover: ## Clean prover directory + rm -rf miden-base + +.PHONY: prover +prover: ## Setup prover directory + if [ -d miden-base ]; then cd miden-base; else git clone https://github.com/0xPolygonMiden/miden-base.git && cd miden-base; fi + cd miden-base && git checkout $(PROVER_BRANCH) && git pull origin $(PROVER_BRANCH) + cd miden-base && cargo update + +.PHONY: start-prover +start-prover: ## Run prover. This requires the base repo to be present at `miden-base` + cd miden-base && RUST_LOG=info cargo run --bin miden-tx-prover --locked $(PROVER_FEATURES_TESTING) + +.PHONY: kill-prover +kill-prover: ## Kill prover process + pkill miden-tx-prover || echo 'process not running' + # --- Installing ---------------------------------------------------------------------------------- install: ## Install the CLI binary diff --git a/crates/web-client/package.json b/crates/web-client/package.json index 3cbb2b644..699c44714 100644 --- a/crates/web-client/package.json +++ b/crates/web-client/package.json @@ -20,7 +20,7 @@ "scripts": { "build": "rimraf dist && rollup -c rollup.config.js && cpr js/types dist && node clean.js", "test": "node --loader ts-node/esm ./node_modules/mocha/bin/mocha --file ./test/mocha.global.setup.mjs", - "test:remote": "npm install && MIDEN_WEB_TESTING=true npm run build && cross-env REMOTE_PROVER=true node --loader ts-node/esm ./node_modules/mocha/bin/mocha --file ./test/mocha.global.setup.mjs", + "test:remote_prover": "npm install && MIDEN_WEB_TESTING=true npm run build && cross-env REMOTE_PROVER=true node --loader ts-node/esm ./node_modules/mocha/bin/mocha --file ./test/mocha.global.setup.mjs", "test:logs": "cross-env DEBUG_MODE=true node --loader ts-node/esm --loader esm ./node_modules/mocha/bin/mocha --file ./test/mocha.global.setup.mjs", "test:clean": "npm install && MIDEN_WEB_TESTING=true npm run build && node --loader ts-node/esm --loader esm ./node_modules/mocha/bin/mocha --file ./test/mocha.global.setup.mjs" },