diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 193949dd..12b316c2 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: "elois-test-overrides" + MOONBEAM_LAST_CLIENT_TAG: "v0.18.0" + jobs: list-spec-versions: @@ -101,3 +105,34 @@ 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 + WASM_RUNTIME_OVERRIDES: moonbase-overrides + run: ./scripts/test-last-tracing-runtime.sh diff --git a/.gitignore b/.gitignore index 291cd43a..1a0f363b 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 00000000..f81beff5 --- /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/import-tracing-runtime.sh b/scripts/import-tracing-runtime.sh index b4cb8fb0..f029753b 100755 --- a/scripts/import-tracing-runtime.sh +++ b/scripts/import-tracing-runtime.sh @@ -46,7 +46,7 @@ GIT_REF=${2:-"runtime-$SPEC_VERSION"} echo "Get moonbeam branch..." rm -rf tmp mkdir tmp -git clone https://github.com/PureStake/moonbeam -b $GIT_REF tmp/moonbeam +git clone https://github.com/PureStake/moonbeam --depth 1 -b $GIT_REF tmp/moonbeam # Copy relevant files echo "Copy relevant files and folders..." diff --git a/scripts/test-last-tracing-runtime.sh b/scripts/test-last-tracing-runtime.sh new file mode 100755 index 00000000..838b1d41 --- /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'