Add revive-differential-tests CI #6166
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Tests" | |
| # If you modify more test jobs, ensure that you add them as required to the job "confirmTestPassed" | |
| # which is located at the end of this file (more info in the job) | |
| on: | |
| push: | |
| branches: ["main", "release-*"] | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| FRAME_OMNI_BENCHER_RELEASE_VERSION: polkadot-stable2506 | |
| # cancel previous runs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # This generates a matrix with all the required jobs which will be run in the next step | |
| runtime-matrix: | |
| runs-on: self-hosted | |
| outputs: | |
| runtime: ${{ steps.runtime.outputs.runtime }} | |
| name: Extract runtimes from matrix | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: runtime | |
| run: | | |
| TASKS=$(echo $(cat .github/workflows/runtimes-matrix.json) | sed 's/ //g' ) | |
| echo $TASKS | |
| echo "runtime=$TASKS" >> $GITHUB_OUTPUT | |
| integration-test-matrix: | |
| runs-on: self-hosted | |
| outputs: | |
| itest: ${{ steps.itest.outputs.itest }} | |
| name: Extract integration tests from matrix | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: itest | |
| run: | | |
| TASKS=$(echo $(cat .github/workflows/integration-tests-matrix.json) | sed 's/ //g' ) | |
| echo $TASKS | |
| echo "itest=$TASKS" >> $GITHUB_OUTPUT | |
| # Job required by "confirmTestPassed" | |
| runtime-test: | |
| needs: [runtime-matrix] | |
| runs-on: self-hosted | |
| strategy: | |
| matrix: | |
| runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install updates and dependencies | |
| run: .github/install-deps.sh | |
| - name: Set rust version via common env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{env.RUST_STABLE_VERSION}}" | |
| - name: Fetch cache | |
| uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | |
| with: | |
| shared-key: "fellowship-cache-runtime-tests" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Download frame-omni-bencher | |
| run: | | |
| curl --max-time 10 --retry 5 --retry-delay 10 --retry-max-time 120 -sL https://github.com/paritytech/polkadot-sdk/releases/download/$FRAME_OMNI_BENCHER_RELEASE_VERSION/frame-omni-bencher -o frame-omni-bencher | |
| chmod +x ./frame-omni-bencher | |
| ./frame-omni-bencher --version | |
| shell: bash | |
| - name: Test ${{ matrix.runtime.name }} | |
| run: | | |
| if [ -n "${{ matrix.runtime.build_extra_features }}" ]; then | |
| cargo test -p ${{ matrix.runtime.package }} --release --locked -q --features ${{ matrix.runtime.build_extra_features }} | |
| else | |
| cargo test -p ${{ matrix.runtime.package }} --release --locked -q | |
| fi | |
| env: | |
| RUSTFLAGS: "-C debug-assertions -A warnings" # FAIL-CI AHM | |
| - name: Test all features ${{ matrix.runtime.name }} | |
| run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q --all-features | |
| env: | |
| RUSTFLAGS: "-C debug-assertions -A warnings" # FAIL-CI AHM | |
| SKIP_WASM_BUILD: 1 | |
| WS: ${{ matrix.runtime.uri }} | |
| RUST_LOG: "remote-ext=info" | |
| - name: Test benchmarks ${{ matrix.runtime.name }} | |
| run: | | |
| PACKAGE_NAME=${{ matrix.runtime.package }} | |
| RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm | |
| RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME | |
| # build wasm | |
| echo "Preparing wasm for benchmarking RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH" | |
| if [ -n "${{ matrix.runtime.build_extra_features }}" ]; then | |
| cargo build --profile production -p ${{ matrix.runtime.package }} --features=runtime-benchmarks,${{ matrix.runtime.build_extra_features }} -q --locked | |
| else | |
| cargo build --profile production -p ${{ matrix.runtime.package }} --features=runtime-benchmarks -q --locked | |
| fi | |
| # run benchmarking | |
| if [ -z "${{ matrix.runtime.benchmarks_exclude_extrinsics }}" ]; then | |
| EXCLUDE_EXTRINSICS="" | |
| else | |
| EXCLUDE_EXTRINSICS_JSON='${{ toJson(matrix.runtime.benchmarks_exclude_extrinsics) }}' | |
| EXCLUDE_EXTRINSICS_LIST=$(echo "$EXCLUDE_EXTRINSICS_JSON" | jq -r 'to_entries | map("\(.key)::\(.value[])") | join(" ")') | |
| EXCLUDE_EXTRINSICS=" --exclude-extrinsics ${EXCLUDE_EXTRINSICS_LIST}" | |
| fi | |
| echo "Running benchmarking for RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH $EXCLUDE_EXTRINSICS" | |
| ./frame-omni-bencher v1 benchmark pallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1 $EXCLUDE_EXTRINSICS --heap-pages 4096 | |
| env: | |
| RUSTFLAGS: "-C debug-assertions -A warnings" # FAIL-CI AHM | |
| # Job required by "confirmTestPassed" | |
| integration-test: | |
| needs: [integration-test-matrix] | |
| runs-on: self-hosted | |
| strategy: | |
| matrix: | |
| itest: ${{ fromJSON(needs.integration-test-matrix.outputs.itest) }} | |
| steps: | |
| - name: Cancel previous runs | |
| uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # v0.11.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install updates and dependencies | |
| run: .github/install-deps.sh | |
| - name: Set rust version via common env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{env.RUST_STABLE_VERSION}}" | |
| - name: Fetch cache | |
| uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | |
| with: | |
| shared-key: "fellowship-cache-integration-tests" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Test ${{ matrix.itest.name }} | |
| run: cargo test -p ${{ matrix.itest.package }} --release --locked -q | |
| env: | |
| RUSTFLAGS: "-C debug-assertions -A warnings" # FAIL-CI AHM | |
| # Job required by "confirmTestPassed" | |
| build-chain-spec-generator: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Cancel previous runs | |
| uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # v0.11.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install updates and dependencies | |
| run: .github/install-deps.sh | |
| - name: Set rust version via common env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{env.RUST_STABLE_VERSION}}" | |
| - name: Fetch cache | |
| uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | |
| with: | |
| shared-key: "fellowship-cache-chain-spec-tests" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Check | |
| run: cargo check -p chain-spec-generator --release --locked -q --features=all-runtimes | |
| env: | |
| RUSTFLAGS: "-C debug-assertions -A warnings" # FAIL-CI AHM | |
| SKIP_WASM_BUILD: 1 | |
| # Job required by "confirmTestPassed" | |
| zombienet-smoke: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Cancel previous runs | |
| uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # v0.11.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install updates and dependencies | |
| run: .github/install-deps.sh | |
| - name: Set rust version via common env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{env.RUST_STABLE_VERSION}}" | |
| - name: Fetch cache | |
| uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | |
| with: | |
| shared-key: "fellowship-cache-zombienet-tests" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Build | |
| run: | | |
| cargo build -p chain-spec-generator --no-default-features --features fast-runtime,polkadot,coretime-polkadot --release --locked | |
| - name: Wait for Docker to Start | |
| run: | | |
| timeout 30 sh -c 'until docker info; do sleep 1; done' | |
| docker --version | |
| - name: Zombienet smoke test | |
| timeout-minutes: 20 | |
| run: | | |
| # Since we are running the runner in a dind environment we need to find the ip | |
| # of the proxy where the ports will be exposed. | |
| # In the current infra there are 2 containes, the `dind` and the runner. | |
| export ZOMBIE_LOCAL_IP=$(hostname -i | awk -F"." '{printf "%d.%d.%d.%d", $1, $2, $3, $4 - 1}') | |
| export PATH=$(pwd)/target/release:$PATH | |
| cargo test --manifest-path integration-tests/zombienet/Cargo.toml | |
| build-runtimes: | |
| needs: [runtime-matrix] | |
| runs-on: self-hosted | |
| strategy: | |
| # Ensure the other jobs are continue | |
| fail-fast: false | |
| matrix: | |
| runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Set rust version via common env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{env.RUST_STABLE_VERSION}}" | |
| - name: Fetch cache | |
| uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | |
| with: | |
| shared-key: "fellowship-cache-build-runtimes-test" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Build runtime ${{ matrix.runtime.name }} | |
| run: | | |
| PACKAGE_NAME=${{ matrix.runtime.package }} | |
| RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm | |
| RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME | |
| # Build wasm | |
| echo "Building wasm RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH" | |
| FEATURES="" | |
| # Find out if the `metadata-hash` feature exists for the given package. | |
| if cargo metadata --format-version=1 | jq '.packages[] | select(.name=="${{ matrix.runtime.package }}") | .features' | grep metadata-hash; then | |
| FEATURES="metadata-hash" | |
| fi | |
| # Add extra features | |
| if [ -n "${{ matrix.runtime.build_extra_features }}" ]; then | |
| if [ -z "$FEATURES" ]; then | |
| FEATURES="${{ matrix.runtime.build_extra_features }}" | |
| else | |
| FEATURES="$FEATURES,${{ matrix.runtime.build_extra_features }}" | |
| fi | |
| fi | |
| if [ -n "$FEATURES" ]; then | |
| FEATURES="--features=$FEATURES" | |
| fi | |
| # We only enable `metadata-hash`, but not `on-chain-release-build` to still have logs enabled. | |
| echo "Setting features: ${FEATURES}" | |
| cargo build --profile production -p ${{ matrix.runtime.package }} $FEATURES -q --locked | |
| echo "RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH" >> $GITHUB_ENV | |
| - name: Upload ${{ matrix.runtime.name }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.runtime.name }} | |
| path: ${{ env.RUNTIME_BLOB_PATH }} | |
| ecosystem-tests: | |
| needs: [runtime-matrix, build-runtimes] | |
| runs-on: self-hosted | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Checkout polkadot-ecosystem-tests | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: open-web3-stack/polkadot-ecosystem-tests | |
| path: ecosystem-tests | |
| - name: Download WASM artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Setup runtime overrides | |
| run: | | |
| jq --raw-output '.[] | .name, .package' .github/workflows/runtimes-matrix.json | while read -r NAME && read -r PACKAGE; do | |
| NAME="$(echo $NAME | tr -d '-' | tr '[:lower:]' '[:upper:]')" | |
| RUNTIME_BLOB_NAME=$(echo $PACKAGE | sed 's/-/_/g').compact.compressed.wasm | |
| echo "Setting runtime override ${NAME}_WASM=$(pwd)/${RUNTIME_BLOB_NAME}" | |
| # Set the path to the build runtimes | |
| eval "export ${NAME}_WASM=$(pwd)/${RUNTIME_BLOB_NAME}" | |
| done | |
| - name: Use latest Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "node" | |
| - name: Install yarn | |
| run: npm install -g yarn | |
| - name: Installing dependencies of ecosystem tests | |
| working-directory: ecosystem-tests | |
| run: yarn install | |
| - name: Running ecosystem tests | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 90 | |
| max_attempts: 3 | |
| command: cd ecosystem-tests && yarn test | |
| revive-differential-tests: | |
| needs: [build-runtimes] | |
| runs-on: self-hosted | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ runner.environment == 'github-hosted' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| tool-cache: false | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Checkout polkadot-sdk | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: paritytech/polkadot-sdk | |
| - name: Set rust version via common env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{env.RUST_STABLE_VERSION}}" | |
| - name: Download WASM artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Setup runtime overrides | |
| run: | | |
| jq --raw-output '.[] | .name, .package' .github/workflows/runtimes-matrix.json | while read -r NAME && read -r PACKAGE; do | |
| NAME="$(echo $NAME | tr -d '-' | tr '[:lower:]' '[:upper:]')" | |
| RUNTIME_BLOB_NAME=$(echo $PACKAGE | sed 's/-/_/g').compact.compressed.wasm | |
| echo "Setting runtime override ${NAME}_WASM=$(pwd)/${RUNTIME_BLOB_NAME}" | |
| # Set the path to the build runtimes | |
| eval "export ${NAME}_WASM=$(pwd)/${RUNTIME_BLOB_NAME}" | |
| done | |
| - name: Build the polkadot-omni-node | |
| run: cargo build --profile production --bin polkadot-omni-node | |
| - name: Run the Kusama Differential Tests | |
| uses: paritytech/revive-differential-tests/.github/actions/run-differential-tests@main | |
| with: | |
| platform: polkadot-omni-node-revm-solc | |
| cargo-command: "cargo" | |
| revive-differential-tests-ref: "main" | |
| resolc-version: "0.5.0" | |
| polkadot-omnichain-node-runtime-path: ./asset_hub_kusama_runtime.compact.compressed.wasm | |
| polkadot-omnichain-node-parachain-id: 1000 | |
| # This will only run if all the tests in its "needs" array passed. | |
| # Add this as your required job, becuase if the matrix changes size (new things get added) | |
| # it will still require all the steps to succeed. | |
| # If you add more jobs, remember to add them to the "needs" array. | |
| confirmTestPassed: | |
| runs-on: self-hosted | |
| name: All tests passed | |
| # If any new job gets added, be sure to add it to this list | |
| needs: | |
| - runtime-test | |
| - integration-test | |
| - build-chain-spec-generator | |
| - zombienet-smoke | |
| - ecosystem-tests | |
| steps: | |
| - run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY |