|
| 1 | +name: EVM test suite |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize, reopened, ready_for_review] |
| 9 | + merge_group: |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + preflight: |
| 16 | + uses: ./.github/workflows/reusable-preflight.yml |
| 17 | + |
| 18 | + evm-test-suite: |
| 19 | + needs: [preflight] |
| 20 | + runs-on: ${{ needs.preflight.outputs.RUNNER }} |
| 21 | + if: ${{ needs.preflight.outputs.changes_rust }} |
| 22 | + timeout-minutes: 60 |
| 23 | + container: |
| 24 | + image: ${{ needs.preflight.outputs.IMAGE }} |
| 25 | + env: |
| 26 | + # Enable debug assertions since we are running optimized builds for testing |
| 27 | + # but still want to have debug assertions. |
| 28 | + RUSTFLAGS: "-C debug-assertions" |
| 29 | + RUST_BACKTRACE: 1 |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: script |
| 35 | + run: | |
| 36 | + forklift cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc |
| 37 | + forklift cargo build --bin substrate-node |
| 38 | +
|
| 39 | + - name: Checkout evm-tests |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + repository: paritytech/evm-test-suite |
| 43 | + ref: 7762a35a380023a800d213b8ff98f3fb45500661 |
| 44 | + path: evm-test-suite |
| 45 | + |
| 46 | + - uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: 22 |
| 49 | + |
| 50 | + - name: script |
| 51 | + env: |
| 52 | + # EVM tests don't work with batchSize 300 on self-hosted runners in docker container |
| 53 | + BATCH_SIZE: 100 |
| 54 | + run: | |
| 55 | + echo "Change to the evm-test-suite directory" |
| 56 | + cd evm-test-suite |
| 57 | + echo "Download the resolc binary" |
| 58 | + wget https://github.com/paritytech/revive/releases/download/v0.1.0-dev.9/resolc -q |
| 59 | + chmod +x resolc |
| 60 | + mv resolc /usr/local/bin |
| 61 | + resolc --version |
| 62 | +
|
| 63 | + echo "Check that binaries are in place" |
| 64 | + export NODE_BIN_PATH=$(readlink -f ../target/debug/substrate-node) |
| 65 | + export ETH_RPC_PATH=$(readlink -f ../target/production/eth-rpc) |
| 66 | + export RESOLC_PATH=/usr/local/bin/resolc |
| 67 | + echo $NODE_BIN_PATH $ETH_RPC_PATH $RESOLC_PATH |
| 68 | +
|
| 69 | + echo "Install npm dependencies" |
| 70 | + npm install |
| 71 | + # cat matter-labs-tests/hardhat.config.ts | grep batchSize |
| 72 | +
|
| 73 | + echo "Installing solc" |
| 74 | + wget https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux -q |
| 75 | + chmod +x solc-static-linux |
| 76 | + mv solc-static-linux /usr/local/bin/solc |
| 77 | + echo "Run the tests" |
| 78 | + echo "bash init.sh --kitchensink -- --matter-labs -- $NODE_BIN_PATH $ETH_RPC_PATH $RESOLC_PATH" |
| 79 | + bash init.sh --kitchensink -- --matter-labs -- $NODE_BIN_PATH $ETH_RPC_PATH $RESOLC_PATH |
| 80 | +
|
| 81 | + - name: Collect tests results |
| 82 | + if: always() |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: evm-test-suite-${{ github.sha }} |
| 86 | + path: evm-test-suite/test-logs/matter-labs-tests.log |
| 87 | + |
| 88 | + confirm-required-test-evm-jobs-passed: |
| 89 | + runs-on: ubuntu-latest |
| 90 | + name: All test misc tests passed |
| 91 | + # If any new job gets added, be sure to add it to this array |
| 92 | + needs: |
| 93 | + - evm-test-suite |
| 94 | + if: always() && !cancelled() |
| 95 | + steps: |
| 96 | + - run: | |
| 97 | + tee resultfile <<< '${{ toJSON(needs) }}' |
| 98 | + FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) |
| 99 | + if [ $FAILURES -gt 0 ]; then |
| 100 | + echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY |
| 101 | + exit 1 |
| 102 | + else |
| 103 | + echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY |
| 104 | + fi |
0 commit comments