Skip to content

Release EVM bridge contracts #10

Release EVM bridge contracts

Release EVM bridge contracts #10

Workflow file for this run

name: "Release EVM bridge contracts"
on:
workflow_dispatch:
inputs:
contracts:
description: Release version tag
required: true
evm-contract:
description: EVM contract release tag
required: false
default: v1.0.0
eosio:
description: EOSIO release tag
required: true
cdt-tag:
description: CDT release tag
required: true
cdt-version:
description: CDT version where cdt being installed
required: false
default: 3.1.0
jobs:
# Setup Main Dependencies Here
setup-dependencies:
permissions:
contents: 'read'
id-token: 'write'
name: "Build contracts"
timeout-minutes: 10
runs-on: ubuntu-latest
container:
# This repository can be found / pushed to in: ultraio/eosio-docker-starter
image: quay.io/ultra.io/eosio-docker-starter:5.0.0
options: --cpus 2
steps:
- name: Get Token
id: application_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
- name: "Set env vars"
run: |
echo "EOSIO_VERSION=${{ github.event.inputs.eosio }}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${{ github.event.inputs.contracts }}" >> $GITHUB_ENV
echo "CDT_TAG=${{ github.event.inputs.cdt-tag }}" >> $GITHUB_ENV
echo "CDT_VERSION=${{ github.event.inputs.cdt-tag }}" >> $GITHUB_ENV
echo "ULTRA_PATH=/__w/eos-evm-contract/eos-evm-contract/ultra/" >> $GITHUB_ENV
echo "EVM_CONTRACT_VERSION=${{ github.event.inputs.evm-contract }}" >> $GITHUB_ENV
# Update dependencies
- name: 'Update dependencies'
run: |
apt-get update -y \
&& apt-get install tree clang jq xxd -y
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Setup solc
run: npm install -g [email protected]
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
path: evm-bridge-contracts
ref: '${{ env.RELEASE_VERSION }}'
# Download the EOSIO.CDT Deb
- name: Download EOSIO.CDT Debian Image
uses: Legion2/[email protected]
with:
repository: ultraio/eosio.cdt
tag: '${{ github.event.inputs.cdt-tag }}'
path: ./ultra
file: eosio-cdt-${{ env.CDT_TAG }}.deb
token: '${{ steps.application_token.outputs.token }}'
# Install EOSIO.CDT Debian Image
- name: Install EOSIO.CDT Debian Image
run: apt install ./ultra/eosio-cdt-${{ env.CDT_TAG }}.deb -y
- name: Check EOSIO.CDT Install
run: cdt-cpp --version
# Download the EOSIO Deb
- name: Download EOSIO Debian Image
uses: Legion2/[email protected]
with:
repository: ultraio/eosio
tag: '${{ github.event.inputs.eosio }}'
path: ./ultra
file: eosio-${{ env.EOSIO_VERSION }}.deb
token: '${{ steps.application_token.outputs.token }}'
# Install EOSIO Debian Image
- name: Install EOSIO Debian Image
run: apt install ./ultra/eosio-${{ env.EOSIO_VERSION }}.deb -y
# Download the EVM contract
- name: Download EVM contract release
uses: Legion2/[email protected]
with:
repository: ultraio/eos-evm-contract
tag: '${{ github.event.inputs.evm-contract }}'
path: ./ultra
file: build.tar.gz
token: '${{ steps.application_token.outputs.token }}'
- name: Run nodeos
run: |
nodeos -e -p eosio \
--plugin eosio::chain_api_plugin \
--resource-monitor-not-shutdown-on-threshold-exceeded \
--delete-all-blocks >> nodeos.log 2>&1 &
sleep 5
tail -20 ./nodeos.log
# Check if the hash generator is present in build script.
- name: Check if code hash generator is existed
working-directory: ./
id: main
continue-on-error: true
run: |
echo HAS_HASH_GENERATION=$(test -e ./.github/workflows/generate_code_hash.sh && echo 1 || echo 0) >> $GITHUB_ENV
echo ${{ env.HAS_HASH_GENERATION }}
- name: Download hash generation script if it is missing
if: ${{ env.HAS_HASH_GENERATION == 0 }}
working-directory: evm-bridge-contracts
run: |
ls -l
wget 'https://raw.githubusercontent.com/ultraio/evm-bridge-contracts/refs/heads/feature/BLOCK-2590-deploy-evm-contract/.github/workflows/generate_code_hash.sh' -O ./.github/workflows/generate_code_hash.sh
chmod +x ./.github/workflows/generate_code_hash.sh
- name: Extract EOS EVM Contract
id: evm-contract
run: |
ls -l
mkdir contract
mv ./ultra/build.tar.gz contract/contract.tar.gz
cd contract
tar xvf contract.tar.gz
cd build
echo "EVM_CONTRACT=$(pwd)" >> "$GITHUB_OUTPUT"
- name: Disable tests
working-directory: evm-bridge-contracts
run: sed -i -e 's/add_subdirectory (tests)/#add_subdirectory (tests)/g' ./antelope_contracts/CMakeLists.txt
- name: Build EVM Bridge Contracts
shell: bash
run: |
ls -l
pushd evm-bridge-contracts
cmake -B build -Deosevm_DIR=${{ steps.evm-contract.outputs.EVM_CONTRACT }} -DENABLE_TESTS=false
cmake --build build -- -j
tar -pc build | zstd --long -T0 -9 > build.tar.zst
- name: Upload builddir
uses: actions/upload-artifact@v4
with:
name: builddir
path: evm-bridge-contracts/build.tar.zst
compression-level: 0
- name: Code Hash Generations
working-directory: evm-bridge-contracts
run: |
./.github/workflows/generate_code_hash.sh
sed 's/^/* /;s/$//' ./build/antelope_contracts/contracts/hash.txt >> ./CHANGELOG.txt
mv ./build/antelope_contracts/contracts/hash.txt ./build/antelope_contracts/contracts/antelope_contracts-${{ env.RELEASE_VERSION }}-hash.txt
- name: ZIP Contracts and rename code hash
working-directory: evm-bridge-contracts/build/antelope_contracts/contracts
run: |
rm -rf ./CMakeFiles
rm -rf ./stubs
find ../contracts -type f \( -name \*\.abi -o -name \*\.wasm \) | xargs tar -rf evm-bridge-contracts-${{ env.RELEASE_VERSION }}.tar.gz
sha256sum ./evm-bridge-contracts-${{ env.RELEASE_VERSION }}.tar.gz > evm-bridge-contracts-${{ env.RELEASE_VERSION }}-checksum.txt
- name: Release with Code Hashes
uses: ultraio/action-gh-release@master
env:
GITHUB_TOKEN: ${{ steps.application_token.outputs.token }}
with:
name: Release ${{ env.RELEASE_VERSION }}
tag_name: ${{ env.RELEASE_VERSION }}
files: |
./evm-bridge-contracts/build/antelope_contracts/contracts/evm-bridge-contracts-${{ env.RELEASE_VERSION }}.tar.gz
./evm-bridge-contracts/build/antelope_contracts/contracts/*-checksum.txt
./evm-bridge-contracts/build/antelope_contracts/contracts/*-hash.txt
./evm-bridge-contracts/build.tar.zst
body_path: ./evm-bridge-contracts/CHANGELOG.txt
retries: 3
retry_interval: 1000
delete_on_existing: true