-
Notifications
You must be signed in to change notification settings - Fork 37
163 lines (149 loc) · 5.48 KB
/
extrinsic-ordering-check.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
158
159
160
161
162
163
name: Extrinsic Ordering Check
on:
workflow_dispatch:
inputs:
reference_url:
description: The WebSocket url of the reference node
default: wss://heiko-rpc.parallel.fi
required: true
chain:
description: The name of the chain under test. Usually, you would pass a local chain
default: heiko-dev
required: true
jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.PAT_RUNNER }}
ec2-image-id: ${{ secrets.EC2_IMAGE_ID_CI }}
ec2-instance-type: ${{ secrets.EC2_INSTANCE_TYPE }}
subnet-id: ${{ secrets.SUBNET_ID }}
security-group-id: ${{ secrets.SECURITY_GROUP_ID }}
aws-resource-tags: >
[
{"Key": "Name", "Value": "${{ github.workflow }}"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
check:
if: github.repository == 'parallel-finance/parallel'
name: Run check
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
env:
CHAIN: ${{github.event.inputs.chain}}
REF_URL: ${{github.event.inputs.reference_url}}
steps:
- name: cleaning up
run: |
echo '${{ secrets.RUNNER_PASSWORD }}' | sudo -S chown -R $USER:$USER $GITHUB_WORKSPACE
echo "HOME=/home/ubuntu" >> ${GITHUB_ENV}
apt update -y && apt install git-lfs -y
df -hT
- name: Install Dependencies
run: |
echo "update apt packge ..."
sudo apt update -y
sudo apt install apt-transport-https curl ca-certificates software-properties-common -y
echo "add apt-get nodejs16.x and PGP"
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
echo "install nodejs and npm...."
sudo apt-get install -y nodejs
node -v && npm -v
npm install --global yarn
yarn --version
sudo apt install build-essential make cmake -y
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-11-15
components: rustfmt, clippy
override: true
- name: Install wasm32-unknown-unknown
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-11-15
target: wasm32-unknown-unknown
override: true
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Build binary
run: |
cargo build --workspace --exclude runtime-integration-tests --release --bin parallel
./target/release/parallel --version
- name: Start local node
run: |
echo Running on $CHAIN
./target/release/parallel --chain=$CHAIN &
- name: Prepare output
run: |
VERSION=$(./target/release/parallel --version)
echo "Metadata comparison:" >> output.txt
echo "Date: $(date)" >> output.txt
echo "Reference: $REF_URL" >> output.txt
echo "Target version: $VERSION" >> output.txt
echo "Chain: $CHAIN" >> output.txt
echo "----------------------------------------------------------------------" >> output.txt
- name: Pull polkadot-js-tools image
run: docker pull jacogr/polkadot-js-tools
- name: Compare the metadata
run: |
CMD="docker run --pull always --network host jacogr/polkadot-js-tools metadata $REF_URL ws://localhost:9944"
echo -e "Running:\n$CMD"
$CMD >> output.txt
sed -z -i 's/\n\n/\n/g' output.txt
cat output.txt | egrep -n -i ''
SUMMARY=$(./scripts/ci/extrinsic-ordering-filter.sh output.txt)
echo -e $SUMMARY
echo -e $SUMMARY >> output.txt
- name: Show result
run: |
cat output.txt
- name: Stop our local node
run: pkill parallel
- name: Save output as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.CHAIN }}
path: |
output.txt
stop-runner:
name: stop self-hosted EC2 runner
needs:
- start-runner
- check
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.PAT_RUNNER }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}