Skip to content

Commit f0d8de5

Browse files
authored
Add generic workflow dispatch with default for the substrate node-template (#31)
1 parent 02068bc commit f0d8de5

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

.github/workflows/manual.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Manual Build
2+
3+
env:
4+
SUBWASM_VERSION: 0.15.0
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
srtool_tag:
10+
description: The SRTOOL tag to use
11+
default: 1.56.1
12+
required: false
13+
srtool_image:
14+
description: The SRTOOL image to use
15+
default: paritytech/srtool
16+
required: false
17+
chain:
18+
description: The chain to use
19+
default: node-template
20+
required: false
21+
package:
22+
description: The package to be used
23+
default: node-template-runtime
24+
required: true
25+
repository:
26+
description: The repository to be used
27+
default: paritytech/substrate
28+
required: true
29+
runtime_dir:
30+
description: The runtime_dir to be used
31+
default: bin/node-template/runtime/
32+
required: true
33+
ref:
34+
description: The ref to be used for the repo
35+
default: master
36+
required: false
37+
jobs:
38+
build:
39+
name: Build ${{ github.event.inputs.respository }}/${{ github.event.inputs.package }} ${{ github.event.inputs.ref }}
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v2
43+
with:
44+
repository: ${{ github.event.inputs.respository }}
45+
ref: ${{ github.event.inputs.ref }}
46+
fetch-depth: 0
47+
48+
- name: Srtool build
49+
id: srtool_build
50+
uses: chevdor/[email protected]
51+
with:
52+
chain: ${{ github.event.inputs.chain }}
53+
package: ${{ github.event.inputs.package }}
54+
image: ${{ github.event.inputs.srtool_image }}
55+
tag: ${{ github.event.inputs.srtool_tag }}
56+
runtime_dir: ${{ github.event.inputs.runtime_dir }}
57+
58+
- name: Summary
59+
run: |
60+
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ github.event.inputs.chain }}-srtool-digest.json
61+
cat ${{ github.event.inputs.chain }}-srtool-digest.json
62+
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}"
63+
64+
# it takes a while to build the runtime, so let's save the artifact as soon as we have it
65+
- name: Archive Artifacts for ${{ github.event.inputs.chain }}
66+
uses: actions/upload-artifact@v2
67+
with:
68+
name: ${{ github.event.inputs.chain }}-runtime
69+
path: |
70+
${{ steps.srtool_build.outputs.wasm }}
71+
${{ steps.srtool_build.outputs.wasm_compressed }}
72+
${{ github.event.inputs.chain }}-srtool-digest.json
73+
74+
# We now get extra information thanks to subwasm,
75+
- name: Install subwasm ${{ env.SUBWASM_VERSION }}
76+
run: |
77+
wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
78+
sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
79+
subwasm --version
80+
- name: Show Runtime information
81+
run: |
82+
subwasm info ${{ steps.srtool_build.outputs.wasm }}
83+
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }}
84+
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ github.event.inputs.chain }}-info.json
85+
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-info_compressed.json
86+
- name: Extract the metadata
87+
run: |
88+
subwasm meta ${{ steps.srtool_build.outputs.wasm }}
89+
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ github.event.inputs.chain }}-metadata.json
90+
- name: Check the metadata diff
91+
run: |
92+
subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ github.event.inputs.chain }} | tee ${{ github.event.inputs.chain }}-diff.txt
93+
94+
- name: Archive Subwasm results
95+
uses: actions/upload-artifact@v2
96+
with:
97+
name: ${{ github.event.inputs.chain }}-runtime
98+
path: |
99+
${{ github.event.inputs.chain }}-info.json
100+
${{ github.event.inputs.chain }}-info_compressed.json
101+
${{ github.event.inputs.chain }}-metadata.json
102+
${{ github.event.inputs.chain }}-diff.txt

0 commit comments

Comments
 (0)