Skip to content

Zombienet

Zombienet #35

Workflow file for this run

name: Zombienet
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
push:
paths:
- 'tests/**'
- '.github/workflows/main.yaml'
jobs:
check:
outputs:
new_release: ${{ steps.check.outputs.new_release }}
cumulus-binary-release-tag: ${{ steps.cumulus-binary-release-tag.outputs.tag }}
cumulus-wasm-release-tag: ${{ steps.cumulus-wasm-release-tag.outputs.tag }}
wasm-injector-release-tag: ${{ steps.wasm-injector-release-tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
ref: feat/cicd
- uses: oprypin/find-latest-tag@v1
with:
repository: LimeChain/wasm-injector # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
id: wasm-injector-release-tag # The step ID to refer to later.
- run: echo "Wasm injector is at version ${{ steps.wasm-injector-release-tag.outputs.tag }}"
- uses: oprypin/find-latest-tag@v1
with:
repository: paritytech/cumulus # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
prefix: 'v'
id: cumulus-binary-release-tag # The step ID to refer to later.
- run: echo "Cumulus binary is at version ${{ steps.cumulus-binary-release-tag.outputs.tag }}"
- uses: oprypin/find-latest-tag@v1
with:
repository: paritytech/cumulus # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
prefix: 'parachains'
id: cumulus-wasm-release-tag # The step ID to refer to later.
- run: echo "Cumulus WASM is at version ${{ steps.cumulus-wasm-release-tag.outputs.tag }}"
- uses: oprypin/find-latest-tag@v1
with:
repository: soramitsu/kagome # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
id: kagome-release-tag # The step ID to refer to later.
- run: echo "Kagome is at version ${{ steps.kagome-release-tag.outputs.tag }}"
- uses: oprypin/find-latest-tag@v1
with:
repository: paritytech/polkadot # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
id: polkadot-release-tag # The step ID to refer to later.
- run: echo "Polkadot is at version ${{ steps.polkadot-release-tag.outputs.tag }}"
- name: Calculate hash of the tests folder and write to dependencies.txt
run: |
echo "Calculating hash for the tests folder..."
TESTS_HASH=$(find tests -type f -print0 | sort -z | xargs -0 shasum | shasum | awk '{ print $1 }')
echo "Tests folder hash: $TESTS_HASH"
echo "Tests folder hash: $TESTS_HASH" >> dependencies.txt
- name: Write tags to dependencies file
run: |
echo "Cumulus binary tag: ${{ steps.cumulus-binary-release-tag.outputs.tag }}" >> dependencies.txt
echo "Cumulus WASM tag: ${{ steps.cumulus-wasm-release-tag.outputs.tag }}" >> dependencies.txt
echo "Kagome tag: ${{ steps.kagome-release-tag.outputs.tag }}" >> dependencies.txt
echo "Polkadot tag: ${{ steps.polkadot-release-tag.outputs.tag }}" >> dependencies.txt
echo "Wasm injector tag: ${{ steps.wasm-injector-release-tag.outputs.tag }}" >> dependencies.txt
- name: Check if dependencies have changed
id: check
run: |
if git diff-index --quiet HEAD; then
echo "dependencies file has changed!"
echo "new_release=true" >> "$GITHUB_OUTPUT"
else
echo "dependencies file has NOT changed."
echo "new_release=false" >> "$GITHUB_OUTPUT"
fi
- name: Commit latest dependencies
if: ${{ steps.check.outputs.new_release == 'true' }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add dependencies.txt
git commit -m "Update dependencies file"
git pull --rebase origin feat/cicd
git push origin feat/cicd
run-tests:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.new_release == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Fetch Github Release Asset from wasm-injector
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "LimeChain/wasm-injector"
file: "wasm-injector-ubuntu-22"
target: "wasm-injector-ubuntu-22"
version: "tags/${{ needs.check.outputs.wasm-injector-release-tag }}"
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Fetch Github Release Asset from polkadot
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "paritytech/polkadot"
file: "polkadot"
target: "polkadot"
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Fetch Github Release Asset from polkadot-parachain
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "paritytech/cumulus"
file: "polkadot-parachain"
target: "polkadot-parachain"
version: "tags/${{ needs.check.outputs.cumulus-binary-release-tag }}"
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Fetch Github Release Asset from zombienet
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "paritytech/zombienet"
file: "zombienet-linux-x64"
target: "zombienet"
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Fetch Github Release Asset from cumulus
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "paritytech/cumulus"
file: "rococo-parachain_runtime(.*)wasm"
version: "tags/${{ needs.check.outputs.cumulus-wasm-release-tag}}"
target: "./"
regex: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Rename files
run: |
find . -type f -regex '.*/rococo-parachain_runtime.*wasm' -exec mv {} fetched.wasm \;
mv wasm-injector-ubuntu-22 wasm-injector
- name: Fetch kagome
run: |
docker run -v $GITHUB_WORKSPACE:/kagome --rm soramitsu/kagome:latest sh -c "cp /usr/local/bin/kagome . && chmod +x kagome"
- run : |
sudo apt-get update
sudo apt-get install -y --no-install-recommends software-properties-common curl gpg gpg-agent wget
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb http://deb.debian.org/debian/ experimental main" | sudo tee -a /etc/apt/sources.list.d/docker.list > /dev/null
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
sudo add-apt-repository -y "deb http://deb.debian.org/debian/ testing main"
sudo apt-get update
sudo apt-get install --no-install-recommends -y libstdc++6 libc6 libnsl2
- name: Add binaries to PATH and make them executable
run: |
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
chmod +x polkadot
chmod +x polkadot-parachain
chmod +x zombienet
chmod +x wasm-injector
- name: Run wasm-injector
run: |
wasm-injector convert fetched.wasm ./wasm/orig.wasm.hex --hexified
wasm-injector inject stack-overflow validate_block fetched.wasm ./wasm/stack-overflow.wasm.hex --hexified
wasm-injector inject heap-overflow validate_block fetched.wasm ./wasm/heap-overflow.wasm.hex --hexified
wasm-injector inject infinite-loop validate_block fetched.wasm ./wasm/infinite-loop.wasm.hex --hexified
- name: Set up Julia
uses: julia-actions/setup-julia@v1
with:
version: '1.9.1'
- name: Run Polkadot Tests
run: julia scripts/runTests.jl polkadot
- name: Run Kagome Tests
run: julia scripts/runTests.jl kagome