forked from eosnetworkfoundation/eos-evm-contract
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (141 loc) · 5.71 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: "Release EVM contract"
on:
workflow_dispatch:
inputs:
contracts:
description: Release version tag
required: true
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
# Update dependencies
- name: 'Update dependencies'
run: |
apt-get update -y \
&& apt-get install tree clang jq xxd -y
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
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
- 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: ./
run: |
wget 'https://raw.githubusercontent.com/ultraio/eos-evm-contract/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: Build EOS EVM Contract
run: .github/workflows/build-contract.sh
env:
DWITH_TEST_ACTIONS: false
# Build EOSIO.CONTRACTS Repository
# This one builds with the -g tag when it is present.
- name: Code Hash Generations
working-directory: ./
run: |
./.github/workflows/generate_code_hash.sh
sed 's/^/* /;s/$//' ./build/evm_runtime/hash.txt >> ./CHANGELOG.txt
mv ./build/evm_runtime/hash.txt ./build/evm_runtime/eos-evm-contract-${{ env.RELEASE_VERSION }}-hash.txt
- name: ZIP Contracts and rename code hash
working-directory: ./build/evm_runtime
run: |
rm -rf ./CMakeFiles
find ../evm_runtime -type f \( -name \*\.abi -o -name \*\.wasm \) | xargs tar -rf eos-evm-contract-${{ env.RELEASE_VERSION }}.tar.gz
sha256sum ./eos-evm-contract-${{ env.RELEASE_VERSION }}.tar.gz > eos-evm-contract-${{ env.RELEASE_VERSION }}-checksum.txt
- name: Rename build directory archive
run: |
ls -l
mv ./contract.tar.gz ./build.tar.gz
- 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: |
./build/evm_runtime/eos-evm-contract-${{ env.RELEASE_VERSION }}.tar.gz
./build/evm_runtime/*-checksum.txt
./build/evm_runtime/*-hash.txt
./build.tar.gz
body_path: ./CHANGELOG.txt
retries: 3
retry_interval: 1000
delete_on_existing: true