Skip to content
Snippets Groups Projects
Unverified Commit 77ad8abb authored by Javier Viola's avatar Javier Viola Committed by GitHub
Browse files

Migrate substrate zombienet test poc (#7178)

Zombienet substrate tests PoC (using native provider).

cc: @emamihe @alvicsam
parent f7baa84f
Branches
No related merge requests found
Pipeline #512195 waiting for manual action with stages
in 1 hour, 32 minutes, and 52 seconds
......@@ -53,7 +53,7 @@ jobs:
- name: pack artifacts
run: |
mkdir -p ./artifacts
VERSION="${{ needs.preflight.outputs.SOURCE_REF_NAME }}" # will be tag or branch name
VERSION="${{ needs.preflight.outputs.SOURCE_REF_SLUG }}" # will be tag or branch name
mv ./target/testnet/polkadot ./artifacts/.
mv ./target/testnet/polkadot-prepare-worker ./artifacts/.
mv ./target/testnet/polkadot-execute-worker ./artifacts/.
......@@ -62,7 +62,7 @@ jobs:
sha256sum polkadot | tee polkadot.sha256
shasum -c polkadot.sha256
cd ../
EXTRATAG="${{ needs.preflight.outputs.SOURCE_REF_NAME }}-${COMMIT_SHA}"
EXTRATAG="${{ needs.preflight.outputs.SOURCE_REF_SLUG }}-${COMMIT_SHA}"
echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
echo -n ${VERSION} > ./artifacts/VERSION
echo -n ${EXTRATAG} > ./artifacts/EXTRATAG
......@@ -77,7 +77,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -103,7 +103,7 @@ jobs:
mkdir -p ./artifacts
mv ./target/release/polkadot-parachain ./artifacts/.
echo "___The VERSION is either a tag name or the curent branch if triggered not by a tag___"
echo ${{ needs.preflight.outputs.SOURCE_REF_NAME }} | tee ./artifacts/VERSION
echo ${{ needs.preflight.outputs.SOURCE_REF_SLUG }} | tee ./artifacts/VERSION
- name: tar
run: tar -cvf artifacts.tar artifacts
......@@ -111,7 +111,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -147,7 +147,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -172,8 +172,8 @@ jobs:
mkdir -p ./artifacts
mv ./target/testnet/adder-collator ./artifacts/.
mv ./target/testnet/undying-collator ./artifacts/.
echo -n "${{ needs.preflight.outputs.SOURCE_REF_NAME }}" > ./artifacts/VERSION
echo -n "${{ needs.preflight.outputs.SOURCE_REF_NAME }}-${COMMIT_SHA}" > ./artifacts/EXTRATAG
echo -n "${{ needs.preflight.outputs.SOURCE_REF_SLUG }}" > ./artifacts/VERSION
echo -n "${{ needs.preflight.outputs.SOURCE_REF_SLUG }}-${COMMIT_SHA}" > ./artifacts/EXTRATAG
echo "adder-collator version = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
echo "undying-collator version = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
cp -r ./docker/* ./artifacts
......@@ -184,7 +184,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -209,8 +209,8 @@ jobs:
mv ./target/testnet/malus ./artifacts/.
mv ./target/testnet/polkadot-execute-worker ./artifacts/.
mv ./target/testnet/polkadot-prepare-worker ./artifacts/.
echo -n "${{ needs.preflight.outputs.SOURCE_REF_NAME }}" > ./artifacts/VERSION
echo -n "${{ needs.preflight.outputs.SOURCE_REF_NAME }}-${COMMIT_SHA}" > ./artifacts/EXTRATAG
echo -n "${{ needs.preflight.outputs.SOURCE_REF_SLUG }}" > ./artifacts/VERSION
echo -n "${{ needs.preflight.outputs.SOURCE_REF_SLUG }}-${COMMIT_SHA}" > ./artifacts/EXTRATAG
echo "polkadot-test-malus = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
cp -r ./docker/* ./artifacts
......@@ -220,7 +220,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -246,6 +246,7 @@ jobs:
WASM_BUILD_NO_COLOR=1 forklift cargo build --locked --release -p staging-node-cli
ls -la target/release/
- name: pack artifacts
shell: bash
run: |
mv target/release/substrate-node ./artifacts/substrate/substrate
echo -n "Substrate version = "
......@@ -264,7 +265,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -294,7 +295,7 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: ${{ github.job }}-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
path: artifacts.tar
retention-days: 1
......@@ -313,7 +314,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-test-parachain-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-test-parachain-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: tar -xvf artifacts.tar
......@@ -337,7 +338,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-linux-stable-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-linux-stable-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: tar -xvf artifacts.tar
......@@ -361,7 +362,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-test-collators-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-test-collators-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: tar -xvf artifacts.tar
......@@ -385,7 +386,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-malus-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-malus-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: tar -xvf artifacts.tar
......@@ -409,7 +410,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-linux-substrate-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-linux-substrate-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: tar -xvf artifacts.tar
......@@ -441,7 +442,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-linux-stable-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-linux-stable-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: |
tar -xvf artifacts.tar
......@@ -449,7 +450,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-linux-stable-cumulus-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-linux-stable-cumulus-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: |
tar -xvf artifacts.tar
......@@ -457,7 +458,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: prepare-bridges-zombienet-artifacts-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: prepare-bridges-zombienet-artifacts-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: |
tar -xvf artifacts.tar
......@@ -482,7 +483,7 @@ jobs:
- uses: actions/download-artifact@v4.1.8
with:
name: build-linux-stable-cumulus-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
name: build-linux-stable-cumulus-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
- name: tar
run: tar -xvf artifacts.tar
......
# Reusable workflow to set various useful variables
# and to perform checks and generate conditions for other workflows.
# Currently it checks if any Rust (build-related) file is changed
# and if the current (caller) workflow file is changed.
# Example:
#
# jobs:
# preflight:
# uses: ./.github/workflows/reusable-preflight.yml
# some-job:
# needs: changes
# if: ${{ needs.preflight.outputs.changes_rust }}
# .......
name: Zombienet Preflight
on:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
changes_substrate:
value: ${{ jobs.preflight.outputs.changes_substrate }}
ZOMBIENET_IMAGE:
value: ${{ jobs.preflight.outputs.ZOMBIENET_IMAGE }}
description: "ZOMBIENET CI image"
ZOMBIENET_RUNNER:
value: ${{ jobs.preflight.outputs.ZOMBIENET_RUNNER }}
description: |
Main runner for zombienet tests.
DOCKER_IMAGES_VERSION:
value: ${{ jobs.preflight.outputs.DOCKER_IMAGES_VERSION }}
description: |
Version for temp docker images.
# Global vars (from global preflight)
SOURCE_REF_SLUG:
value: ${{ jobs.global_preflight.outputs.SOURCE_REF_SLUG }}
# Zombie vars
PUSHGATEWAY_URL:
value: ${{ jobs.preflight.outputs.PUSHGATEWAY_URL }}
description: "Gateway (url) to push metrics related to test."
DEBUG:
value: ${{ jobs.preflight.outputs.DEBUG }}
description: "Debug value to zombienet v1 tests."
ZOMBIE_PROVIDER:
value: ${{ jobs.preflight.outputs.ZOMBIE_PROVIDER }}
description: "Provider to use in zombienet-sdk tests."
RUST_LOG:
value: ${{ jobs.preflight.outputs.RUST_LOG }}
description: "Log value to use in zombinet-sdk tests."
RUN_IN_CI:
value: ${{ jobs.preflight.outputs.RUN_IN_CI }}
description: "Internal flag to make zombienet aware of the env."
KUBERNETES_CPU_REQUEST:
value: ${{ jobs.preflight.outputs.KUBERNETES_CPU_REQUEST }}
description: "Base cpu (request) for pod runner."
KUBERNETES_MEMORY_REQUEST:
value: ${{ jobs.preflight.outputs.KUBERNETES_MEMORY_REQUEST }}
description: "Base memory (request) for pod runner."
jobs:
global_preflight:
uses: ./.github/workflows/reusable-preflight.yml
#
#
#
preflight:
runs-on: ubuntu-latest
outputs:
changes_substrate: ${{ steps.set_changes.outputs.substrate_any_changed || steps.set_changes.outputs.currentWorkflow_any_changed }}
ZOMBIENET_IMAGE: ${{ steps.set_vars.outputs.ZOMBIENET_IMAGE }}
ZOMBIENET_RUNNER: ${{ steps.set_vars.outputs.ZOMBIENET_RUNNER }}
DOCKER_IMAGES_VERSION: ${{ steps.set_images_version.outputs.ZOMBIENET_RUNNER }}
# common vars
PUSHGATEWAY_URL: ${{ steps.set_vars.outputs.PUSHGATEWAY_URL }}
DEBUG: ${{ steps.set_vars.outputs.DEBUG }}
ZOMBIE_PROVIDER: ${{ steps.set_vars.outputs.ZOMBIE_PROVIDER }}
RUST_LOG: ${{ steps.set_vars.outputs.RUST_LOG }}
RUN_IN_CI: ${{ steps.set_vars.outputs.RUN_IN_CI }}
KUBERNETES_CPU_REQUEST: ${{ steps.set_vars.outputs.KUBERNETES_CPU_REQUEST }}
KUBERNETES_MEMORY_REQUEST: ${{ steps.set_vars.outputs.KUBERNETES_MEMORY_REQUEST }}
steps:
- uses: actions/checkout@v4
#
# Set changes
#
- name: Current file
id: current_file
shell: bash
run: |
echo "currentWorkflowFile=$(echo ${{ github.workflow_ref }} | sed -nE "s/.*(\.github\/workflows\/[a-zA-Z0-9_-]*\.y[a]?ml)@refs.*/\1/p")" >> $GITHUB_OUTPUT
echo "currentActionDir=$(echo ${{ github.action_path }} | sed -nE "s/.*(\.github\/actions\/[a-zA-Z0-9_-]*)/\1/p")" >> $GITHUB_OUTPUT
- name: Set changes
id: set_changes
uses: tj-actions/changed-files@v45
with:
files_yaml: |
substrate:
- 'substrate/**/*'
currentWorkflow:
- '${{ steps.current_file.outputs.currentWorkflowFile }}'
- '.github/workflows/zombienet-reusable-preflight.yml'
- '.github/zombienet-env'
#
# Set environment vars (including runner/image)
#
- name: Set vars
id: set_vars
shell: bash
run: cat .github/env >> $GITHUB_OUTPUT
#
#
#
- name: Set docker images version
id: set_images_version
shell: bash
run: |
export BRANCH_NAME=${{ github.head_ref || github.ref_name }}
export DOCKER_IMAGES_VERSION=${BRANCH_NAME/\//-}
if [[ ${{ github.event_name }} == "merge_group" ]]; then export DOCKER_IMAGES_VERSION="${GITHUB_SHA::8}"; fi
echo "DOCKER_IMAGES_VERSION=${DOCKER_IMAGES_VERSION}" >> $GITHUB_OUTPUT
- name: log
shell: bash
run: |
echo "workflow file: ${{ steps.current_file.outputs.currentWorkflowFile }}"
echo "Modified: ${{ steps.set_changes.outputs.modified_keys }}"
\ No newline at end of file
name: Zombienet Substrate
on:
workflow_run:
workflows: [Build and push images]
types: [completed]
merge_group:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
preflight:
uses: ./.github/workflows/zombienet-reusable-preflight.yml
zombienet-substrate-0000-block-building:
needs: [preflight]
# only run if we have changes in ./substrate directory and the build workflow already finish with success status.
if: ${{ needs.preflight.outputs.changes_substrate && github.event.workflow_run.conclusion == 'success' }}
runs-on: ${{ needs.preflight.outputs.ZOMBIENET_RUNNER }}
timeout-minutes: 60
container:
image: ${{ needs.preflight.outputs.ZOMBIENET_IMAGE }}
env:
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1
LOCAL_DIR: "./substrate/zombienet"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4.1.8
with:
name: build-linux-substrate-${{ needs.preflight.outputs.SOURCE_REF_NAME }}
- name: script
run: |
DEBUG=${{ needs.preflight.outputs.DEBUG }} zombie -p native ${LOCAL_DIR}/0000-block-building/block-building.zndsl
- name: upload logs
uses: actions/upload-artifact@v4
with:
name: zombienet-logs-scale-net
path: |
/tmp/zombie*/logs/*
ZOMBIENET_IMAGE="docker.io/paritytech/zombienet:v1.3.116"
ZOMBIE_RUNNER="zombienet-arc-runner"
PUSHGATEWAY_URL="http://zombienet-prometheus-pushgateway.managed-monitoring:9091/metrics/job/zombie-metrics"
DEBUG="zombie,zombie::network-node,zombie::kube::client::logs"
ZOMBIE_PROVIDER="k8s"
RUST_LOG="info,zombienet_orchestrator=debug"
RUN_IN_CI="1"
KUBERNETES_CPU_REQUEST="512m"
KUBERNETES_MEMORY_REQUEST="1Gi"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment