test(cicd): Rollback changes to the test file #112
Workflow file for this run
This file contains 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: Run zombienet tests | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'tests/**' | ||
- '.github/workflows/main.yaml' | ||
pull_reques: | ||
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 }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
ref: feat/cicd | ||
- 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 | ||
- name: Check if dependencies have changed | ||
env: | ||
EVENT_NAME: ${{github.event_name}} | ||
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 "[email protected]" | ||
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 == 'pull_request' && github.base_ref == 'develop') | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
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 }} | ||
- run: find . -type f -regex '.*/rococo-parachain_runtime.*wasm' -exec mv {} fetched.wasm \; | ||
- 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: Debugging | ||
run: | | ||
echo "Current directory:" | ||
pwd | ||
echo "List files:" | ||
ls -la | ||
echo "GLIBC version:" | ||
ldd --version | ||
echo "GITHUB_WORKSPACE value:" | ||
echo "$GITHUB_WORKSPACE" | ||
- name: Add binaries to PATH | ||
run: | | ||
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH | ||
chmod +x polkadot | ||
chmod +x polkadot-parachain | ||
chmod +x zombienet | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
- run: mv fetched.wasm ./target/debug/test.wasm | ||
- name: Run wasm_injector | ||
run: | | ||
./target/debug/wasm_injector convert ./target/debug/test.wasm ./wasm/orig.wasm.hex --hexified | ||
./target/debug/wasm_injector inject stack-overflow ./target/debug/test.wasm ./wasm/stack-overflow.wasm.hex --hexified | ||
./target/debug/wasm_injector inject heap-overflow ./target/debug/test.wasm ./wasm/heap-overflow.wasm.hex --hexified | ||
./target/debug/wasm_injector inject infinite-loop ./target/debug/test.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 |