-
Notifications
You must be signed in to change notification settings - Fork 35
120 lines (117 loc) · 5.03 KB
/
srtool.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
name: Srtool build
on:
push:
branches:
- master
tags:
- "v*"
jobs:
srtool:
if: github.repository == 'parallel-finance/parallel'
runs-on: ubuntu-latest
strategy:
matrix:
chain: ["heiko", "parallel", "vanilla", "kerria"]
steps:
- uses: actions/checkout@v3
- name: Srtool build
id: srtool_build
uses: chevdor/srtool-actions@v0.6.0
with:
image: paritytech/srtool
tag: 1.66.1
chain: ${{ matrix.chain }}
runtime_dir: runtime/${{ matrix.chain }}
- name: Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.chain }}-srtool-digest.json
cat ${{ matrix.chain }}-srtool-digest.json
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}"
- name: Install subwasm
run: |
wget https://github.com/chevdor/subwasm/releases/download/v0.16.1/subwasm_linux_amd64_v0.16.1.deb
sudo dpkg -i subwasm_linux_amd64_v0.16.1.deb
subwasm --version
- name: Show Runtime information
run: |
subwasm info ${{ steps.srtool_build.outputs.wasm }}
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }}
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-info.json
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.chain }}-info_compressed.json
- name: Extract the metadata
run: |
subwasm meta ${{ steps.srtool_build.outputs.wasm }}
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-metadata.json
- name: Diff with heiko live runtime
if: matrix.chain == 'heiko'
run: |
subwasm get wss://heiko-rpc.parallel.fi:443 --output heiko-live.wasm
subwasm diff ${{ steps.srtool_build.outputs.wasm_compressed }} heiko-live.wasm | tee ${{ matrix.chain }}-diff.txt
- name: Diff with parallel live runtime
if: matrix.chain == 'parallel'
run: |
subwasm get wss://parallel-rpc.dwellir.com:443 --output parallel-live.wasm
subwasm diff ${{ steps.srtool_build.outputs.wasm_compressed }} parallel-live.wasm | tee ${{ matrix.chain }}-diff.txt
- name: Archive Runtime
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain }}-runtime-${{ github.sha }}
path: |
${{ matrix.chain }}-info.json
${{ matrix.chain }}-info_compressed.json
${{ matrix.chain }}-srtool-digest.json
${{ matrix.chain }}-metadata.json
${{ matrix.chain }}-diff.txt
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
- name: Get Runtime Version
if: startsWith(github.ref, 'refs/tags/')
id: runtime_version
run: echo ::set-output name=version::$(cat runtime/${{ matrix.chain }}/src/lib.rs | grep spec_version | tr -d ', ' | cut -d':' -f2)
- name: Get Compressed Runtime Blake2-256 Hash
if: startsWith(github.ref, 'refs/tags/')
id: runtime_blake2_256_hash
run: echo ::set-output name=hash::$(cat ${{ matrix.chain }}-info_compressed.json | jq '.blake2_256' -r)
- name: Get GIT Tag
if: startsWith(github.ref, 'refs/tags/')
id: git_tag
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@master
with:
files: |
${{ matrix.chain }}-info_compressed.json
${{ steps.srtool_build.outputs.wasm_compressed }}
draft: false
prerelease: false
name: Parallel ${{ steps.git_tag.outputs.tag }}
append_body: true
body: |
`${{ matrix.chain }}_runtime-v${{ steps.runtime_version.outputs.version }}.compact.compressed.wasm - ${{ steps.runtime_blake2_256_hash.outputs.hash }}`
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: slack
uses: 8398a7/action-slack@v3
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,eventName,ref,workflow
if: always()
postrelease:
needs: srtool
runs-on: ${{ needs.start-runner.outputs.label }}
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Get GIT Tag
id: git_tag
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: parallel-release-bot
DISCORD_AVATAR: https://avatars.githubusercontent.com/u/79623569
uses: Ilshidur/action-discord@master
with:
args: "Parallel ${{ steps.git_tag.outputs.tag }} has just been released! Go check it out: https://github.com/${{ github.repository }}/releases/tag/${{ steps.git_tag.outputs.tag }}"