-
Notifications
You must be signed in to change notification settings - Fork 48
161 lines (150 loc) · 5.28 KB
/
ci.yml
File metadata and controls
161 lines (150 loc) · 5.28 KB
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
name: Test rust code
on:
push:
branches:
- master
pull_request:
env:
toolchain: stable
target: wasm32-unknown-unknown
try-runtime-chain: dev
try-runtime-uri: wss://eden-api.dwellir.com:443/
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
RUSTFLAGS: ""
jobs:
json-lints:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for json syntax errors 1
run: "for i in `git ls-tree --full-tree -r --name-only HEAD |grep json`; do echo Checking $i:; json_pp <$i >/dev/null || echo ERROR: $i failed; done"
- name: Check for json syntax errors 2
run: "for i in `git ls-tree --full-tree -r --name-only HEAD |grep json`; do echo Checking $i:; json_pp <$i >/dev/null ; done"
lints:
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- name: Setup sccache
uses: mozilla-actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.toolchain }}
components: rustfmt, clippy, rust-src
target: ${{ env.target }}
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
- name: Install protobuf-compiler
run: |
sudo apt-get install protobuf-compiler
- name: Clippy
uses: actions-rs-plus/clippy-check@v2
with:
args: --all-features -- -A clippy::type_complexity -A clippy::identity_op -A clippy::boxed_local -D dead_code
toolchain: ${{ env.toolchain }}
test-runtime:
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.toolchain }}
components: rust-src
target: ${{ env.target }}
- name: Install protobuf-compiler
run: |
sudo apt-get install protobuf-compiler
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Unit tests
# Other tests ran below
run: cargo test --all-features -p nodle-parachain
tests-with-linecoverage:
runs-on: ubuntu-latest-4-cores
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.toolchain }}
target: ${{ env.target }}
components: rust-src
- name: Install protobuf-compiler
run: |
sudo apt-get install protobuf-compiler
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Test and gather coverage
run: cargo llvm-cov --lcov --output-path lcov.info --all-features --workspace --exclude nodle-parachain
- name: Upload to Codecov
uses: codecov/[email protected]
with:
fail_ci_if_error: false
files: lcov.info
try-runtime-prepare:
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- name: Install protobuf-compiler
run: |
sudo apt-get install protobuf-compiler
- name: Install Rust stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.toolchain }}
components: rust-src
target: ${{ env.target }}
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Build runtime
run: cargo build --release --features=try-runtime -p runtime-eden
- name: Upload runtime artifact
uses: actions/upload-artifact@v3
with:
name: try_runtime
path: target/release/wbuild/runtime-eden/runtime_eden.wasm
try-runtime-execute:
runs-on: ubuntu-latest
needs: try-runtime-prepare
steps:
- name: Download runtime artifact
uses: actions/download-artifact@v2
with:
name: try_runtime
path: try_runtime
- name: Check Version
run: |
echo -n "eden_rev=" >> $GITHUB_OUTPUT
curl -s --request POST --url https://nodle-parachain.api.onfinality.io/public --header 'Content-Type: application/json' --data '{
"jsonrpc": "2.0",
"method": "state_getRuntimeVersion",
"params": [],
"id": 1
}' | jq .result.specVersion | sed 's/^/try-runtime-snapshot-eden-spec-/' >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
id: get_version
- name: Setup cache
uses: actions/cache@v3
id: cachedir
with:
path: snapshots
key: ${{steps.get_version.outputs.eden_rev}}
- name: Ensure cache directory is created
if: steps.cachedir.outputs.cache-hit != 'true'
run: |
install -d snapshots
date > snapshots/created_at
- name: Run try-runtime
uses: NodleCode/[email protected]
with:
url: ${{ env.try-runtime-uri}}${{ secrets.DWELLIR_API_KEY}}
snap: snapshots/eden-snapshot-full
runtime: try_runtime/runtime_eden.wasm
checks: "all"
options: "--disable-idempotency-checks"
- name: Upload snap artifact
uses: actions/upload-artifact@v3
with:
name: edensnap
path: snapshots/eden-snapshot-full