-
Notifications
You must be signed in to change notification settings - Fork 69
179 lines (174 loc) · 5.76 KB
/
tests.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: build-and-deploy
on:
push:
branches:
- master
workflow_dispatch:
pull_request:
env:
RELAY_CHAIN_VERSION: v0.9.28
jobs:
build:
runs-on: lark
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- run: git describe --tags --abbrev=0
- name: Setup cmake
uses: jwlawson/[email protected]
- name: Install misc dependencies
run: sudo rm /var/lib/dpkg/lock-frontend && sudo rm /var/lib/dpkg/lock && sudo apt-get install -y protobuf-compiler m4
- name: Install Rust
uses: codota/toolchain@00a8bf2bdcfe93aefd70422d3dec07337959d3a4
with:
profile: minimal
- name: Run clippy
run: make clippy
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Test && Generate code coverage
run: make coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
- name: Build release
run: time cargo build --release --quiet --locked
- name: Version info
run: ./target/release/hydradx --version
- name: Upload release binary
uses: actions/upload-artifact@v2
with:
name: hydradx
path: target/release/hydradx
- name: Upload release wasm
uses: actions/upload-artifact@v2
with:
name: hydradx_runtime.compact.compressed.wasm
path: target/release/wbuild/hydradx-runtime/hydradx_runtime.compact.compressed.wasm
docker:
needs: [build]
runs-on: lark
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Describe version
run: git describe --tags --abbrev=0
- name: Generate metadata for images
id: meta
uses: docker/metadata-action@v3
with:
images: galacticcouncil/hydra-dx,ghcr.io/galacticcouncil/hydra-dx
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: actions/download-artifact@v2
name: Download node binary
with:
name: hydradx
path: target/release
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PKG_USER }}
password: ${{ secrets.PKG_PWD }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
test-inclusion:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/download-artifact@v2
name: Download node binary
with:
name: hydradx
path: target/release
- uses: robinraju/release-downloader@v1
name: Download relay chain binary
with:
repository: paritytech/polkadot
tag: ${{ env.RELAY_CHAIN_VERSION }}
fileName: polkadot
out-file-path: ../polkadot/target/release
- run: chmod +x ./hydradx && ./hydradx --version
name: HydraDX version
working-directory: target/release
- run: chmod +x ./polkadot && ./polkadot --version
name: Polkadot version
working-directory: ../polkadot/target/release
- uses: actions/setup-node@v2
name: Setup node.js
with:
node-version: '14'
check-latest: true
- run: npm install && npm start
name: Launch rococo local & wait for inclusion
working-directory: scripts/wait-for-inclusion
version-check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
outputs:
runtime-upgraded: ${{ steps.check-runtime.outputs.upgraded }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Rust
uses: codota/toolchain@00a8bf2bdcfe93aefd70422d3dec07337959d3a4
with:
profile: minimal
- name: Get crate versions
run: |
VERSION_UPDATE=$(./scripts/list_crate_updates.sh)
VERSION_UPDATE=$(cat << EOF
$VERSION_UPDATE
EOF
)
echo "VERSION_UPDATE<<EOF" >> $GITHUB_ENV
echo "$VERSION_UPDATE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Check runtime upgrade
id: check-runtime
if: contains(env.VERSION_UPDATE, 'Runtime version has been increased.')
run: echo "::set-output name=upgraded::true"
- name: Sticky Pull Request Comment
uses: marocchino/[email protected]
with:
message: |
${{ env.VERSION_UPDATE }}
- name: Evaluate result
if: contains(env.VERSION_UPDATE, 'have not been updated') || contains(env.VERSION_UPDATE, 'versions don''t match') || contains(env.VERSION_UPDATE, 'downgraded')
run: exit 1