-
Notifications
You must be signed in to change notification settings - Fork 49
180 lines (172 loc) · 5.24 KB
/
checks.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
180
name: Checks
on:
push:
branches:
- main
paths:
- "**.rs"
- "**.toml"
- "**.lock"
- "**.ts"
- "**.yml"
- "**.sol"
pull_request:
types: [opened, synchronize, ready_for_review]
branches:
- main
paths:
- "**.rs"
- "**.toml"
- "**.lock"
- "**.ts"
- "**.yml"
- "**.sol"
env:
CACHE_VERSION: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
basic-checks:
name: Task ${{ matrix.action }} darwinia
if: github.event_name == 'push' || !github.event.pull_request.draft
needs: [features-checks]
runs-on: ubuntu-latest
strategy:
matrix:
action: [build, test]
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Set swap space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 8
- name: Fetch latest code
uses: actions/checkout@v4
- name: Setup build environment
run: sudo apt install -y clang llvm protobuf-compiler
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
./target
key: ${{ matrix.action }}-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.action }}-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-
${{ matrix.action }}-${{ env.CACHE_VERSION }}-${{ runner.os }}-
- name: Action ${{ matrix.action }}
if: matrix.action == 'build'
run: cargo b --locked -p darwinia --features all-runtime,evm-tracing --profile ci-dev
- name: Action ${{ matrix.action }}
if: matrix.action == 'test'
run: SKIP_WASM_BUILD=1 cargo t --locked --features all-runtime,runtime-benchmarks --profile ci-dev
- name: Configure artifacts
if: matrix.action == 'build'
run: |
mv target/ci-dev/darwinia .
.github/shrink-cache.sh
- name: Upload
if: matrix.action == 'build'
uses: actions/upload-artifact@v4
with:
name: darwinia
path: darwinia
retention-days: 1
format-checks:
name: Task check format
runs-on: ubuntu-latest
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Install nightly Rust
run: rustup toolchain install nightly && rustup component add rustfmt --toolchain nightly
- name: Check format
run: cargo +nightly fmt --all -- --check
- name: Fast fail
uses: vishnudxb/cancel-workflow@v1.2
if: failure()
with:
repo: darwinia-network/darwinia
workflow_id: ${{ github.run_id }}
access_token: ${{ github.token }}
features-checks:
name: Task check features
if: github.event_name == 'push' || !github.event.pull_request.draft
strategy:
matrix:
runtime: [runtime/darwinia, runtime/crab, runtime/koi]
runs-on: ubuntu-latest
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Check
uses: hack-ink/cargo-featalign-action@v0.1.1
with:
crate: ${{ matrix.runtime }}
features: std,runtime-benchmarks,try-runtime
default-std: true
runtime-checks:
name: Task check runtimes
if: github.event_name == 'push' || !github.event.pull_request.draft
strategy:
matrix:
target:
[
{
chain: darwinia-dev,
compare-with: "https://darwinia-rpc.darwiniacommunitydao.xyz",
},
{
chain: crab-dev,
compare-with: "https://crab-rpc.darwiniacommunitydao.xyz",
},
{
chain: koi-dev,
compare-with: "https://koi-rpc.darwinia.network",
},
]
needs: [basic-checks]
runs-on: ubuntu-latest
steps:
- name: Check ${{ matrix.target.chain }}
uses: hack-ink/subalfred-check-runtime-action@v0.2.1
with:
uploaded-artifact: darwinia
chain: ${{ matrix.target.chain }}
compare-with: ${{ matrix.target.compare-with }}
evm-checks:
name: Task check EVM
if: github.event_name == 'push' || !github.event.pull_request.draft
needs: [basic-checks]
runs-on: ubuntu-latest
steps:
- name: Download darwinia
uses: actions/download-artifact@v4
with:
name: darwinia
- name: Install darwinia
run: |
chmod u+x darwinia
sudo mv darwinia /usr/bin
- name: Launch darwinia
run: darwinia --chain koi-dev --tmp --alice --tracing-api debug,trace --frontier-backend-type sql &
- name: Install Node 19
uses: actions/setup-node@v4
with:
node-version: 19
- name: Fetch latest code
uses: actions/checkout@v4
- name: Action test
run: |
cd tests/ethereum
npm install
npm run test