Skip to content

Run scheduled test #116

Run scheduled test

Run scheduled test #116

name: Run scheduled test
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
concurrency:
group: "scheduled-test"
cancel-in-progress: false
jobs:
run_test:
name: "Run verkle conversion test"
runs-on: [self-hosted-ghr, size-xs-x64]
timeout-minutes: 1440
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Remember start time
id: start_time
shell: bash
run: |
echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
- name: "Install shell dependencies"
shell: bash
run: |
if [ -z "$(which yq)" ]; then
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
fi
apt_updated="0"
if [ -z "$(which jq)" ]; then
[ "$apt_updated" == "1" ] || sudo apt-get update
apt_updated="1"
sudo apt-get install -y jq
fi
if [ -z "$(which envsubst)" ]; then
[ "$apt_updated" == "1" ] || sudo apt-get update
apt_updated="1"
sudo apt-get install -y gettext-base
fi
if [ -z "$(which gh)" ]; then
sudo mkdir -p -m 755 /etc/apt/keyrings
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt-get update
sudo apt-get install -y gh
fi
# setup kubernetes backend
- name: "Install kubectl"
shell: bash
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: "Install rancher CLI"
shell: bash
run: |
curl -L https://github.com/rancher/cli/releases/download/v2.8.0/rancher-linux-amd64-v2.8.0.tar.gz | tar xvz
sudo mv ./rancher-v2.8.0/rancher /usr/local/bin/rancher
- name: Login to rancher & kubernetes cluster
shell: bash
run: |
rancher login --token "${{ secrets.RANCHER_TOKEN }}" "${{ secrets.RANCHER_URL }}" --context c-m-2m5z22jp:p-8vpkn
rancher kubectl config use-context "k3s-berlin"
- name: Generate kubeconfig
id: kubeconfig
shell: bash
run: |
rancher kubectl config view --raw > kubeconfig
echo "kubeconfig=$(cat kubeconfig | base64 -w 0)" >> $GITHUB_OUTPUT
# run kurtosis testnet & verkle conversion test
- name: Run kurtosis testnet
id: testnet
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
kurtosis_extra_args: "--image-download always --non-blocking-tasks --verbosity DETAILED"
kurtosis_backend: "kubernetes"
kubernetes_config: "${{ steps.kubeconfig.outputs.kubeconfig }}"
kubernetes_cluster: "k3s-berlin"
kubernetes_storage_class: "local-path"
ethereum_package_branch: "bbusa/verkle-archive"
ethereum_package_args: "./.github/test/kurtosis-args.yaml"
enclave_name: "verkle-conv-${{ github.run_id }}"
persistent_logs: "true"
# generate error notifications
- name: Send discord notification (on failure)
if: ${{ failure() || steps.testnet.outputs.test_result == 'failure' }}
shell: bash
run: |
if [ -z "$DISCORD_HOOK" ]; then
echo "discord hook missing"
exit 1
fi
mkdir ./temp
touch ./temp/notification_text.txt
echo "**Name:** Verkle Conversion Test" >> ./temp/notification_text.txt
echo "**Status:** ${{ steps.testnet.outputs.test_result }}" >> ./temp/notification_text.txt
start_time="${{ steps.start_time.outputs.start_time }}"
end_time="$(date +%s)"
runtime="$(expr $end_time - $start_time)"
echo "**Run Time:** $(printf '%02dh:%02dm:%02ds\n' $((runtime/3600)) $((runtime%3600/60)) $((runtime%60)))" >> ./temp/notification_text.txt
echo "**Failed Test:**" >> ./temp/notification_text.txt
if [ -z "${{ steps.testnet.outputs.test_result }}" ]; then
echo "kurtosis testnet failed during startup" >> ./temp/notification_text.txt
else
test_status=$(
cat <<"EOF"
${{ steps.testnet.outputs.test_overview }}
EOF
)
echo '```ansi' >> ./temp/notification_text.txt
echo "$test_status" | grep "failure" >> ./temp/notification_text.txt
echo '```' >> ./temp/notification_text.txt
fi
echo "Generate discord message..."
msgjson="{}"
msgjson=$(echo "$msgjson" | jq -c ".title|=$(echo -n "Verkle Conversion Test Failed" | jq -R -s '.')")
msgjson=$(echo "$msgjson" | jq -c ".color|=15083560")
msgjson=$(echo "$msgjson" | jq -c ".url|=$(echo -n "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id}}" | jq -R -s '.')")
msgjson=$(echo "$msgjson" | jq -c ".description|=$(cat ./temp/notification_text.txt | jq -R -s '.')")
hookjson="{}"
hookjson=$(echo "$hookjson" | jq -c ".username|=$(echo -n "Assertoor Test Notification" | jq -R -s '.')")
hookjson=$(echo "$hookjson" | jq -c ".avatar_url|=$(echo -n "https://raw.githubusercontent.com/ethpandaops/assertoor/master/.github/resources/assertoor.png" | jq -R -s '.')")
hookjson=$(echo "$hookjson" | jq -c ".embeds|=[${msgjson}]")
echo $hookjson | jq
echo "Send discord message..."
curl -X POST -H 'Content-Type: application/json' -d "$hookjson" $DISCORD_HOOK
env:
DISCORD_HOOK: ${{ secrets.DISCORD_HOOK }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}