@@ -2,7 +2,6 @@ name: Create release
22
33on :
44 push :
5- branches : [ main ]
65 tags :
76 - " v*.*.*"
87 pull_request :
@@ -18,86 +17,102 @@ jobs:
1817 python-version : [ 3.11 ]
1918 node-version : [ 18.16.0 ]
2019
21- solc-version : [ 0.8.19 ]
2220 ganache-version : [ 7.8.0 ]
2321
24- opt-flags : [ "--optimize --optimize-runs 200" ]
22+ solc-version : [ v0.8.20 ]
23+
24+ env :
25+ SOLC_BIN : ${{ github.workspace }}/build/solc-static-linux
26+ SOLC_FLAGS : >-
27+ --optimize --optimize-runs 200
28+ --revert-strings strip
29+ --via-ir
30+ --overwrite
31+ --base-path ${{ github.workspace }}
32+ --output-dir ${{ github.workspace }}/build/
33+ SOLC_VER_CMD : >-
34+ ${{ github.workspace }}/build/solc-static-linux
35+ --version | tail -n 1 | sed -e "s/^Version: //g"
36+ RELE_NOTE : ${{ github.workspace }}/build/release_note.md
2537
2638 name : A job to create a release
2739 steps :
2840 - name : Checkout
2941 uses : actions/checkout@v3
30-
31- - name : Installing Node ${{ matrix.node-version }}
32- uses : actions/setup-node@v3
3342 with :
34- node-version : ${{ matrix.node-version }}
43+ submodules : recursive
3544
3645 - name : Installing Python ${{ matrix.python-version }}
3746 uses : actions/setup-python@v4
3847 with :
3948 python-version : ${{ matrix.python-version }}
4049
50+ - name : Installing Python packages
51+ run : |
52+ python3 -m pip install --requirement ${{ github.workspace }}/utils/gas_cost_eval_requirements.txt
53+
54+ - name : Installing Node ${{ matrix.node-version }}
55+ uses : actions/setup-node@v3
56+ with :
57+ node-version : ${{ matrix.node-version }}
58+
4159 - name : Installing NPM packages
4260 run : |
43- npm install -g solc@${{ matrix.solc-version }}
4461 npm install -g ganache@${{ matrix.ganache-version }}
4562
46- - name : Installing Python packages
63+ - name : Installing Solc compiler
4764 run : |
48- python3 -m pip install --requirement ${{ github.workspace }}/utils/gas_cost_eval_requirements.txt
65+ mkdir -p ${{ github.workspace }}/build/
66+ curl -fsSL -o ${SOLC_BIN} \
67+ https://github.com/ethereum/solidity/releases/download/${{ matrix.solc-version }}/solc-static-linux
68+ chmod +x ${SOLC_BIN}
4969
5070 - name : Compiling contracts for PubSub/EventManager.sol
5171 run : |
52- solcjs ${{ matrix.opt-flags }} --bin --include-path node_modules/ --base-path . --output-dir ./build/ ./PubSub/EventManager.sol
53- solcjs ${{ matrix.opt-flags }} --abi --include-path node_modules/ --base-path . --output-dir ./build/ ./PubSub/EventManager.sol
54- mv ./build/PubSub_EventManager_sol_EventManager.bin ./build/EventManager.bin
55- mv ./build/PubSub_EventManager_sol_EventManager.abi ./build/EventManager.abi
72+ ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/PubSub/EventManager.sol
73+ ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/PubSub/EventManager.sol
5674
5775 - name : Compiling contracts for PubSub/PubSubService.sol
5876 run : |
59- solcjs ${{ matrix.opt-flags }} --bin --include-path node_modules/ --base-path . --output-dir ./build/ ./PubSub/PubSubService.sol
60- solcjs ${{ matrix.opt-flags }} --abi --include-path node_modules/ --base-path . --output-dir ./build/ ./PubSub/PubSubService.sol
61- mv ./build/PubSub_PubSubService_sol_PubSubService.bin ./build/PubSubService.bin
62- mv ./build/PubSub_PubSubService_sol_PubSubService.abi ./build/PubSubService.abi
77+ ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/PubSub/PubSubService.sol
78+ ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/PubSub/PubSubService.sol
6379
6480 - name : Compiling contracts for tests/HelloWorldSubscriber.sol
6581 run : |
66- solcjs ${{ matrix.opt-flags }} --bin --include-path node_modules/ --base-path . --output-dir ./build/ ./tests/HelloWorldSubscriber.sol
67- solcjs ${{ matrix.opt-flags }} --abi --include-path node_modules/ --base-path . --output-dir ./build/ ./tests/HelloWorldSubscriber.sol
68- mv ./build/tests_HelloWorldSubscriber_sol_HelloWorldSubscriber.bin ./build/HelloWorldSubscriber.bin
69- mv ./build/tests_HelloWorldSubscriber_sol_HelloWorldSubscriber.abi ./build/HelloWorldSubscriber.abi
82+ ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/tests/HelloWorldSubscriber.sol
83+ ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/tests/HelloWorldSubscriber.sol
7084
7185 - name : Compiling contracts for tests/HelloWorldPublisher.sol
7286 run : |
73- solcjs ${{ matrix.opt-flags }} --bin --include-path node_modules/ --base-path . --output-dir ./build/ ./tests/HelloWorldPublisher.sol
74- solcjs ${{ matrix.opt-flags }} --abi --include-path node_modules/ --base-path . --output-dir ./build/ ./tests/HelloWorldPublisher.sol
75- mv ./build/tests_HelloWorldPublisher_sol_HelloWorldPublisher.bin ./build/HelloWorldPublisher.bin
76- mv ./build/tests_HelloWorldPublisher_sol_HelloWorldPublisher.abi ./build/HelloWorldPublisher.abi
87+ ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/tests/HelloWorldPublisher.sol
88+ ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/tests/HelloWorldPublisher.sol
7789
7890 - name : Calculating checksums of the binary
91+ working-directory : ${{ github.workspace }}/build
7992 run : |
80- sha256sum ./build/EventManager.bin >> ./build/checksums.txt
81- sha256sum ./build/EventManager.abi >> ./build/checksums.txt
82- sha256sum ./build/PubSubService.bin >> ./build/checksums.txt
83- sha256sum ./build/PubSubService.abi >> ./build/checksums.txt
84- sha256sum ./build/HelloWorldPublisher.bin >> ./build/checksums.txt
85- sha256sum ./build/HelloWorldPublisher.abi >> ./build/checksums.txt
86- sha256sum ./build/HelloWorldSubscriber.bin >> ./build/checksums.txt
87- sha256sum ./build/HelloWorldSubscriber.abi >> ./build/checksums.txt
93+ sha256sum solc-static-linux >> checksums.txt
94+ sha256sum EventManager.bin >> checksums.txt
95+ sha256sum EventManager.abi >> checksums.txt
96+ sha256sum PubSubService.bin >> checksums.txt
97+ sha256sum PubSubService.abi >> checksums.txt
98+ sha256sum HelloWorldPublisher.bin >> checksums.txt
99+ sha256sum HelloWorldPublisher.abi >> checksums.txt
100+ sha256sum HelloWorldSubscriber.bin >> checksums.txt
101+ sha256sum HelloWorldSubscriber.abi >> checksums.txt
88102
89103 - name : Prepare binaries for gas cost evaluation
104+ working-directory : ${{ github.workspace }}/build
90105 run : |
91- mkdir -p ./build/ PubSub
92- cp ./build/ EventManager.bin ./build/ PubSub/EventManager.bin
93- cp ./build/ EventManager.abi ./build/ PubSub/EventManager.abi
94- cp ./build/ PubSubService.bin ./build/ PubSub/PubSubService.bin
95- cp ./build/ PubSubService.abi ./build/ PubSub/PubSubService.abi
96- mkdir -p ./build/ tests
97- cp ./build/ HelloWorldPublisher.bin ./build/ tests/HelloWorldPublisher.bin
98- cp ./build/ HelloWorldPublisher.abi ./build/ tests/HelloWorldPublisher.abi
99- cp ./build/ HelloWorldSubscriber.bin ./build/ tests/HelloWorldSubscriber.bin
100- cp ./build/ HelloWorldSubscriber.abi ./build/ tests/HelloWorldSubscriber.abi
106+ mkdir -p PubSub
107+ cp EventManager.bin PubSub/EventManager.bin
108+ cp EventManager.abi PubSub/EventManager.abi
109+ cp PubSubService.bin PubSub/PubSubService.bin
110+ cp PubSubService.abi PubSub/PubSubService.abi
111+ mkdir -p tests
112+ cp HelloWorldPublisher.bin tests/HelloWorldPublisher.bin
113+ cp HelloWorldPublisher.abi tests/HelloWorldPublisher.abi
114+ cp HelloWorldSubscriber.bin tests/HelloWorldSubscriber.bin
115+ cp HelloWorldSubscriber.abi tests/HelloWorldSubscriber.abi
101116
102117 - name : Run publish gas cost evaluation
103118 run : |
@@ -107,40 +122,59 @@ jobs:
107122 run : |
108123 python3 ${{ github.workspace }}/tests/GasCostEvalMultiPubs.py
109124
125+ - name : Run deployment gas cost evaluation
126+ run : |
127+ python3 ${{ github.workspace }}/tests/GasCostEvalDeploy.py
128+
110129 - name : Plot gas cost evaluation result figures
111130 run : |
112131 python3 ${{ github.workspace }}/tests/GasCostEvalPlot.py
113132
114133 - name : Generate release note
134+ working-directory : ${{ github.workspace }}/build
115135 run : |
116- echo "# Release note" >> ./build/release_note.md
117- echo "## Contracts" >> ./build/release_note.md
118- echo "- PubSub/EventManager.sol" >> ./build/release_note.md
119- echo "- PubSub/PubSubService.sol" >> ./build/release_note.md
120- echo "- tests/HelloWorldPublisher.sol" >> ./build/release_note.md
121- echo "- tests/HelloWorldSubscriber.sol" >> ./build/release_note.md
122- echo "" >> ./build/release_note.md
123- echo "## Build configurations" >> ./build/release_note.md
124- echo "- OS: \`${{ matrix.os }}\`" >> ./build/release_note.md
125- echo "- Node version: \`$(node --version)\`" >> ./build/release_note.md
126- echo "- Solc version: \`$(solcjs --version)\`" >> ./build/release_note.md
127- echo "- Optimizations: \`${{ matrix.opt-flags }}\`" >> ./build/release_note.md
128- echo "" >> ./build/release_note.md
129- echo "## Checksums" >> ./build/release_note.md
130- echo "\`\`\`" >> ./build/release_note.md
131- cat ./build/checksums.txt >> ./build/release_note.md
132- echo "\`\`\`" >> ./build/release_note.md
133- echo "" >> ./build/release_note.md
134- echo "## Gas Cost Evaluations" >> ./build/release_note.md
135- echo "### Gas Cost of Publishing Events" >> ./build/release_note.md
136- echo "" >> ./build/release_note.md
137- echo '!'"[publish_gas_cost](/../../blob/assets-gas-eval/assets/${{ github.ref_name }}-publish_gas_cost.svg)" >> ./build/release_note.md
138- echo "" >> ./build/release_note.md
139- echo "### Gas cost of Subscribing to Publishers" >> ./build/release_note.md
140- echo "" >> ./build/release_note.md
141- echo '!'"[subscribe_gas_cost](/../../blob/assets-gas-eval/assets/${{ github.ref_name }}-subscribe_gas_cost.svg)" >> ./build/release_note.md
142- echo "" >> ./build/release_note.md
143- echo "" >> ./build/release_note.md
136+ echo "# Release note" >> ${RELE_NOTE}
137+ echo "" >> ${RELE_NOTE}
138+ echo "## Contracts" >> ${RELE_NOTE}
139+ echo "- PubSub/EventManager.sol" >> ${RELE_NOTE}
140+ echo "- PubSub/PubSubService.sol" >> ${RELE_NOTE}
141+ echo "- tests/HelloWorldPublisher.sol" >> ${RELE_NOTE}
142+ echo "- tests/HelloWorldSubscriber.sol" >> ${RELE_NOTE}
143+ echo "" >> ${RELE_NOTE}
144+ echo "## Build configurations" >> ${RELE_NOTE}
145+ echo "- OS: \`${{ matrix.os }}\`" >> ${RELE_NOTE}
146+ echo "- Solc version: \`$(bash -c "${SOLC_VER_CMD}")\`" >> ${RELE_NOTE}
147+ echo "- Compiler Flags: \`${SOLC_FLAGS}\`" >> ${RELE_NOTE}
148+ echo "" >> ${RELE_NOTE}
149+ echo "## Checksums" >> ${RELE_NOTE}
150+ echo "\`\`\`" >> ${RELE_NOTE}
151+ cat checksums.txt >> ${RELE_NOTE}
152+ echo "\`\`\`" >> ${RELE_NOTE}
153+ echo "" >> ${RELE_NOTE}
154+ echo "## Gas Cost Evaluations" >> ${RELE_NOTE}
155+ echo "### Gas Cost of Publishing Events" >> ${RELE_NOTE}
156+ echo "" >> ${RELE_NOTE}
157+ echo '!'"[publish_gas_cost](/../../blob/assets-gas-eval/assets/${{ github.ref_name }}-publish_gas_cost.svg)" >> ${RELE_NOTE}
158+ echo "" >> ${RELE_NOTE}
159+ echo "### Gas Cost of Publisher Registeration" >> ${RELE_NOTE}
160+ echo "" >> ${RELE_NOTE}
161+ echo '!'"[register_gas_cost](/../../blob/assets-gas-eval/assets/${{ github.ref_name }}-register_gas_cost.svg)" >> ${RELE_NOTE}
162+ echo "" >> ${RELE_NOTE}
163+ echo "### Gas Cost of Subscribing to Publishers" >> ${RELE_NOTE}
164+ echo "" >> ${RELE_NOTE}
165+ echo '!'"[subscribe_gas_cost](/../../blob/assets-gas-eval/assets/${{ github.ref_name }}-subscribe_gas_cost.svg)" >> ${RELE_NOTE}
166+ echo "" >> ${RELE_NOTE}
167+ echo "### Gas Cost of Contract Deployment" >> ${RELE_NOTE}
168+ echo "\`\`\`json" >> ${RELE_NOTE}
169+ cat deploy_gas_cost.json >> ${RELE_NOTE}
170+ echo "" >> ${RELE_NOTE}
171+ echo "\`\`\`" >> ${RELE_NOTE}
172+ echo "" >> ${RELE_NOTE}
173+ echo "### Gas Cost Summary" >> ${RELE_NOTE}
174+ echo "" >> ${RELE_NOTE}
175+ echo '!'"[gas_cost](/../../blob/assets-gas-eval/assets/${{ github.ref_name }}-gas_cost.svg)" >> ${RELE_NOTE}
176+ echo "" >> ${RELE_NOTE}
177+ echo "" >> ${RELE_NOTE}
144178
145179 - name : Echo release note
146180 run : |
@@ -165,6 +199,9 @@ jobs:
165199 ${{ github.workspace }}/build/publish_gas_cost.json
166200 ${{ github.workspace }}/build/subscribe_gas_cost.svg
167201 ${{ github.workspace }}/build/subscribe_gas_cost.json
202+ ${{ github.workspace }}/build/register_gas_cost.svg
203+ ${{ github.workspace }}/build/register_gas_cost.json
204+ ${{ github.workspace }}/build/deploy_gas_cost.json
168205 ${{ github.workspace }}/build/gas_cost.svg
169206
170207 - name : Store evaluation figures to assets branch
@@ -182,6 +219,11 @@ jobs:
182219 --path "assets/${{ github.ref_name }}-subscribe_gas_cost.svg" \
183220 --commit-msg "Uploaded file assets/${{ github.ref_name }}-subscribe_gas_cost.svg" \
184221 --file "${{ github.workspace }}/build/subscribe_gas_cost.svg"
222+ python3 ${{ github.workspace }}/utils/GitHubCreateFile.py \
223+ --branch assets-gas-eval \
224+ --path "assets/${{ github.ref_name }}-register_gas_cost.svg" \
225+ --commit-msg "Uploaded file assets/${{ github.ref_name }}-register_gas_cost.svg" \
226+ --file "${{ github.workspace }}/build/register_gas_cost.svg"
185227 python3 ${{ github.workspace }}/utils/GitHubCreateFile.py \
186228 --branch assets-gas-eval \
187229 --path "assets/${{ github.ref_name }}-gas_cost.svg" \
@@ -206,3 +248,7 @@ jobs:
206248 ${{ github.workspace }}/build/publish_gas_cost.json
207249 ${{ github.workspace }}/build/subscribe_gas_cost.svg
208250 ${{ github.workspace }}/build/subscribe_gas_cost.json
251+ ${{ github.workspace }}/build/register_gas_cost.svg
252+ ${{ github.workspace }}/build/register_gas_cost.json
253+ ${{ github.workspace }}/build/deploy_gas_cost.json
254+ ${{ github.workspace }}/build/gas_cost.svg
0 commit comments