Schedule based benchmark of pallet-contracts and pallet-evm #32
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: Schedule based smart-bench tests of pallet-contracts and pallet-evm | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
download_and_test_parachain_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Moonbeam Release | |
id: moonbeam_release | |
run: | | |
API_URL="https://api.github.com/repos/karolk91/moonbeam/releases/latest" | |
RESPONSE=$(curl -s "${API_URL}") | |
# Get the download URL of the release binary from Repo | |
DOWNLOAD_URL=$(echo $RESPONSE | jq -r '.assets | map(select(.name == "moonbeam.gz")) | .[0].browser_download_url') | |
RELEASE_TAG=$(echo $RESPONSE | jq -r '.tag_name') | |
mkdir -p bin | |
curl -L ${DOWNLOAD_URL} | tar -xzv -C bin && chmod +x bin/moonbeam | |
echo "tag=$(echo ${RELEASE_TAG})" >> $GITHUB_OUTPUT | |
- name: Download Polkadot-Parachain Release | |
id: polkadot_parachain_release | |
run: | | |
API_URL="https://api.github.com/repos/paritytech/cumulus/releases/latest" | |
RESPONSE=$(curl -s "${API_URL}") | |
# Get the download URL of the release binary from Repo | |
DOWNLOAD_URL=$(echo $RESPONSE | jq -r '.assets | map(select(.name == "polkadot-parachain")) | .[0].browser_download_url') | |
RELEASE_TAG=$(echo $RESPONSE | jq -r '.tag_name') | |
mkdir -p bin | |
curl -L -o bin/polkadot-parachain ${DOWNLOAD_URL} && chmod +x bin/polkadot-parachain | |
echo "tag=$(echo ${RELEASE_TAG})" >> $GITHUB_OUTPUT | |
# We need polkadot version to check compatibility and commit sha | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: 'smart-bench' | |
- name: Display variables | |
run: | | |
echo moonbeam_tag: ${{ steps.moonbeam_release.outputs.tag }} | |
echo polkadot_parachain_tag: ${{ steps.polkadot_parachain_release.outputs.tag }} | |
- name: Execute tests | |
id: run_smart_bench | |
run: | | |
# ink solang and solidity versions to be printed | |
RELEASE_COMMIT_SHA=$(echo ${{ github.event.client_payload }} | jq -r '.sha') | |
INPUT_POLKADOT_VERSION=$(echo ${{ github.event.client_payload }} | jq -r '.polkadot_version') | |
cd smart-bench/launch | |
./download-bins.sh | |
# overwrite polkadot-parachain and moonbeam | |
cp ../../bin/* ./bin | |
./build.sh | |
echo "ink=$(./run.sh -- ink-wasm erc20 --instance-count 1 --call-count 10 | grep -E '^\d{4}: PoV')" >> $GITHUB_OUTPUT | |
echo "sol=$(./run.sh -- sol-wasm erc20 --instance-count 1 --call-count 10 | grep -E '^\d{4}: PoV')" >> $GITHUB_OUTPUT | |
echo "evm=$(./run.sh -- evm erc20 --instance-count 1 --call-count 10 | grep -E '^\d{4}: PoV')" >> $GITHUB_OUTPUT | |
- name: Extract benchmark lines | |
id: extract | |
run: | | |
# Capture the relevant lines and save them to a file | |
WORK_DIR="smart-bench/results" | |
echo ${{ steps.run_smart_bench.outputs.ink }} > ${WORK_DIR}/benchmark_ink.txt | |
echo ${{ steps.run_smart_bench.outputs.sol }} > ${WORK_DIR}/benchmark_sol.txt | |
echo ${{ steps.run_smart_bench.outputs.evm }} > ${WORK_DIR}/benchmark_evm.txt | |
echo "Extracted benchmark lines:" | |
cat ${WORK_DIR}/benchmark_ink.txt | |
cat ${WORK_DIR}/benchmark_sol.txt | |
cat ${WORK_DIR}/benchmark_evm.txt | |
- name: Commit benchmark lines | |
run: | | |
cd smart-bench/results | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add benchmark_ink.txt benchmark_sol.txt benchmark_evm.txt | |
git commit -m "Add benchmark results" | |
git push | |