diff --git a/.github/workflows/vm-pr.yml b/.github/workflows/vm-pr.yml index da81a09d0c..35e796b903 100644 --- a/.github/workflows/vm-pr.yml +++ b/.github/workflows/vm-pr.yml @@ -39,7 +39,7 @@ jobs: working-directory: ${{github.workspace}} - run: npm run coverage - + - uses: codecov/codecov-action@v1 with: file: ${{ env.cwd }}/coverage/lcov.info @@ -48,7 +48,7 @@ jobs: - run: npm run test:API - run: npm run test:API:browser - run: npm run lint - + vm-state: runs-on: ubuntu-latest strategy: @@ -131,9 +131,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - # Args to pass to the tester. Note that some have splitted the slow tests and only + # Args to pass to the tester. Note that some have splitted the slow tests and only # running those: these are only on forks where that is applicable (see PR #489 for numbers on these) - + # Tests were splitted with --dir and --excludeDir to balance execution times below the 9min mark. args: [ '--fork=Istanbul --dir=GeneralStateTests/stTimeConsuming --expected-test-amount=15561', @@ -171,9 +171,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - # Args to pass to the tester. Note that some have splitted the slow tests and only + # Args to pass to the tester. Note that some have splitted the slow tests and only # running those: these are only on forks where that is applicable (see PR #489 for numbers on these) - + # Tests were splitted with --dir and --excludeDir to balance execution times below the 9min mark. args: [ '--fork=Berlin --expected-test-amount=33', @@ -212,6 +212,37 @@ jobs: - run: npm run test:blockchain -- ${{ matrix.args }} + vm-backwards-compatibility: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Dependency cache + uses: actions/cache@v2 + id: cache + with: + key: VM-${{ runner.os }}-12-${{ hashFiles('**/package-lock.json') }} + path: '**/node_modules' + + # Installs root dependencies, ignoring Bootstrap All script. + # Bootstraps the current package only + - run: npm install --ignore-scripts && npm run bootstrap:vm + if: steps.cache.outputs.cache-hit != 'true' + working-directory: ${{github.workspace}} + + # Builds current package and the ones it depends from. + - run: npm run build:vm + working-directory: ${{github.workspace}} + + # Runs vm test:API with @ethereumjs/tx@3.0.2 + - run: npm run check:compatibility -- -t vm -d tx -n @ethereumjs/tx -v "3.0.2" -s test:API + working-directory: ${{github.workspace}} + vm-benchmarks: runs-on: ubuntu-latest steps: diff --git a/package.json b/package.json index f98166f1dc..1f32f386fe 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "test": "lerna exec npm run test --parallel", "coverage": "lerna run coverage --stream", "docs:build": "lerna run docs:build --ignore @ethereumjs/ethash", - "clean": "rm -rf node_modules packages/*/node_modules packages/*/test-build packages/*/dist packages/*/dist.browser packages/*/package-lock.json" + "clean": "rm -rf node_modules packages/*/node_modules packages/*/test-build packages/*/dist packages/*/dist.browser packages/*/package-lock.json", + "check:compatibility": "bash ./scripts/check-compatibility.sh" } } diff --git a/scripts/check-compatibility.sh b/scripts/check-compatibility.sh new file mode 100755 index 0000000000..b77613e66c --- /dev/null +++ b/scripts/check-compatibility.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +# -------------------------------------------------------------------------------------------------- +# A script to test the backwards compatibility of monorepo packages +# with previously published monorepo package sub dependencies. +# +# Substitutes a current package with another version of it installed from npm +# and runs the tests of a package which consumes it. +# +# The monorepo is restored to orignal state after script completes, so this script +# can be run repeatedly for different scenarios in CI +# +# # USAGE +# -t the monorepo package whose tests we'd like to run (ex: vm) +# -d the monorepo package dependency we want to swap out (ex: tx) +# -n the npm package name to swap in (ex: @ethereumjs/tx) +# -v the npm package version to swap in (ex: 3.0.2) +# -s