diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 193949d..06fb81d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,10 @@ on: pull_request: types: [opened, edited, synchronize] +env: + MOONBEAM_GIT_REF: "master" + MOONBEAM_LAST_CLIENT_TAG: "v0.22.0" + jobs: list-spec-versions: @@ -101,3 +105,35 @@ jobs: if: steps.filter.outputs.edited == 'true' || steps.filter.outputs.shared == 'true' run: | ./scripts/check-tracing-runtime.sh ${{ matrix.spec_version }} + + test-last-tracing-runtime: + name: "Test last tracing runtime" + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + needs: ["check-tracing-runtime"] + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Get moonbeam binary + run: | + ./scripts/get-moonbeam-binary.sh $MOONBEAM_LAST_CLIENT_TAG + - name: "Setup node" + uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: Copy tests folder + run: | + rm -rf tests tmp + mkdir tests tmp + git clone https://github.com/PureStake/moonbeam --depth 1 -b $MOONBEAM_GIT_REF tmp/moonbeam + cp -r tmp/moonbeam/moonbeam-types-bundle . + cp -r tmp/moonbeam/tests . + - name: Typescript tracing tests (against dev service) + continue-on-error: true + env: + ETHAPI_CMD: --ethapi=txpool,debug,trace + FORCE_WASM_EXECUTION: true + WASM_RUNTIME_OVERRIDES: moonbase-overrides + run: ./scripts/test-last-tracing-runtime.sh diff --git a/.gitignore b/.gitignore index 291cd43..1a0f363 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,7 @@ # Ignore build directory populated by CI build -# Ignore temporary files +# Ignore moonbeam test files +moonbeam-types-bundle +tests tmp diff --git a/scripts/get-moonbeam-binary.sh b/scripts/get-moonbeam-binary.sh new file mode 100755 index 0000000..f81beff --- /dev/null +++ b/scripts/get-moonbeam-binary.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +CLIENT_TAG=$1 +CLIENT_IMAGE="purestake/moonbeam:$CLIENT_TAG" + +mkdir -p target/release +docker create -ti --name dummy $CLIENT_IMAGE bash +docker cp dummy:/moonbeam/moonbeam target/release/moonbeam +docker rm -f dummy diff --git a/scripts/test-last-tracing-runtime.sh b/scripts/test-last-tracing-runtime.sh new file mode 100755 index 0000000..838b1d4 --- /dev/null +++ b/scripts/test-last-tracing-runtime.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +WASM_RUNTIME_OVERRIDES="moonbase-overrides" + +chmod uog+x target/release/moonbeam +mkdir -p tests/$WASM_RUNTIME_OVERRIDES +cp wasm/moonbase-* tests/$WASM_RUNTIME_OVERRIDES +cd moonbeam-types-bundle +npm install +npm run build +cd ../tests +npm install +node_modules/.bin/mocha --parallel -j 1 -r ts-node/register 'tracing-tests/**/test-*.ts'