-
Notifications
You must be signed in to change notification settings - Fork 4
208 lines (172 loc) · 6.89 KB
/
ci.yaml
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: test
on:
push:
branches:
- master
- staging
- release-v*
pull_request:
jobs:
rustfmt:
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
components: rustfmt, clippy
- name: Install dprint
run: cargo install --locked dprint
- name: Dprint check
run: dprint check
- name: Install nightly toolchain
run: rustup toolchain install nightly
- name: Install cargo-fmt for nightly toolchain
run: rustup component add rustfmt --toolchain nightly
- name: cargo fmt
run: cargo +nightly fmt --all -- --check
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: --enable=all --shell=bash
with:
severity: style
scandir: './scripts'
cargo-deny:
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: cargo-deny check
uses: EmbarkStudios/cargo-deny-action@v1
# Test each client individually, once testing the whole workspace can hide some compilation errors
# ex: testing using --workspace enable the same feature flags for all crates
test-client:
needs: [rustfmt]
strategy:
matrix:
crate: [rosetta-server-astar, rosetta-server-ethereum, rosetta-server-polkadot, rosetta-client, rosetta-testing-arbitrum, rosetta-testing-binance, rosetta-testing-avalanche, rosetta-testing-base, rosetta-testing-linea, ]
name: ${{ matrix.crate }}
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v4
# - run: sudo add-apt-repository ppa:ethereum/ethereum
- run: sudo apt-get update -y
- name: Install deps
run: sudo apt-get install -y musl-dev musl-tools solc
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
components: clippy
target: x86_64-unknown-linux-musl
override: true
- name: cargo clippy (${{ matrix.crate }})
run: |
cargo clippy --locked -p ${{ matrix.crate }} --examples --tests -- \
-Dwarnings \
-Dclippy::unwrap_used \
-Dclippy::expect_used \
-Dclippy::nursery \
-Dclippy::pedantic \
-Aclippy::module_name_repetitions
- name: Cleanup Docker
run: ./scripts/reset_docker.sh
- name: Pull nodes
run: ./scripts/pull_nodes.sh
- name: Checkout nitro-testnode
if: ${{ matrix.crate == 'rosetta-testing-arbitrum' }}
run: git clone -b release --depth=1 --no-tags --recurse-submodules https://github.com/ManojJiSharma/nitro-testnode.git
- name: Start arbitrum nitro-testnode
if: ${{ matrix.crate == 'rosetta-testing-arbitrum' }}
run: |
cd nitro-testnode
./test-node.bash --detach
- name: Checkout Optimism
if: ${{ matrix.crate == 'rosetta-testing-base' }}
run: |
git clone https://github.com/ethereum-optimism/optimism.git
cd optimism
make devnet-up
- name: Setup avalanche-cli node
if: ${{matrix.crate == 'rosetta-testing-avalanche'}}
run: |
docker pull analoglabs/avalanche-cli
docker run -v MY_LOCAL_CLI_DIR:/root/.avalanche-cli/ analoglabs/avalanche-cli blockchain create localnew --evm --evm-token SUB --genesis ./genesis.json --teleporter=false --vm-version v0.6.9
docker run -d -v MY_LOCAL_CLI_DIR:/root/.avalanche-cli/ -p 9650:9650 --entrypoint bash analoglabs/avalanche-cli -c "/avalanche blockchain deploy localnew --local;tail -f /dev/null"
- name: Setup BSC node
if: ${{ matrix.crate == 'rosetta-testing-binance' }}
run: |
docker pull manojanalog/bsc_for_analog
docker run -d -p 8545:8545 -p 8546:8546 manojanalog/bsc_for_analog:latest geth --datadir ./datadir --unlock 0x5e5C830f97292a3C6Bfea464D3ad4CE631e6Fbc5 --allow-insecure-unlock --http --http.addr 0.0.0.0 --http.port 8545 --http.api personal,db,eth,net,web3 --mine --miner.etherbase 0x5e5C830f97292a3C6Bfea464D3ad4CE631e6Fbc5 --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api personal,db,eth,net,web3 --rpc.allow-unprotected-txs --password password.txt
- name: Setup Linea-monorepo node
if: ${{ matrix.crate == 'rosetta-testing-linea' }}
run: |
git clone https://github.com/Consensys/linea-monorepo.git
cd linea-monorepo
make pnpm-install
make fresh-start-all
- name: test (${{ matrix.crate }})
run: cargo test --locked -p ${{ matrix.crate }}
# Test all crates, excluding the clients
test:
needs: [rustfmt]
runs-on: self-hosted
env:
CLIPPY_FLAGS: -Dwarnings -Dclippy::unwrap_used -Dclippy::expect_used -Dclippy::nursery -Dclippy::pedantic -Aclippy::module_name_repetitions
name: cargo test --workspace --all-features
steps:
- name: Checkout sources
uses: actions/checkout@v4
# - run: sudo add-apt-repository ppa:ethereum/ethereum
- run: sudo apt-get update -y
- name: Install deps
run: sudo apt-get install -y musl-dev musl-tools solc
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
components: clippy
target: wasm32-unknown-unknown
override: true
- name: clippy
run: |
cargo clippy --locked --workspace --examples --tests --all-features \
--exclude rosetta-testing-arbitrum \
--exclude rosetta-server-astar \
--exclude rosetta-testing-avalanche \
--exclude rosetta-testing-binance \
--exclude rosetta-testing-linea \
--exclude rosetta-server-ethereum \
--exclude rosetta-testing-base \
--exclude rosetta-server-polkadot \
--exclude rosetta-client \
-- \
${CLIPPY_FLAGS}
- name: check.sh --fmt
run: ./scripts/check.sh --fmt
# Test crates with different feature flags, including wasm32-unknown-unknown
# This is done to ensure that those libraries can be used inside the substrate runtime
- name: check.sh --eth-types
run: ./scripts/check.sh --eth-types
- name: check.sh --eth-backend
run: ./scripts/check.sh --eth-backend
- name: Pull nodes
run: ./scripts/pull_nodes.sh
- name: cargo test
run: |
cargo test --locked --workspace --all-features \
--exclude rosetta-testing-arbitrum \
--exclude rosetta-server-astar \
--exclude rosetta-testing-avalanche \
--exclude rosetta-testing-binance \
--exclude rosetta-testing-linea \
--exclude rosetta-server-ethereum \
--exclude rosetta-testing-base \
--exclude rosetta-server-polkadot \
--exclude rosetta-client
- name: Cleanup Docker
run: ./scripts/reset_docker.sh