-
Notifications
You must be signed in to change notification settings - Fork 4
187 lines (179 loc) · 6.03 KB
/
ci.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
181
182
183
184
185
186
187
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
__GEAR_WASM_BUILDER_NO_FEATURES_TRACKING: 1
jobs:
build:
runs-on: kuberunner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install golang
uses: actions/setup-go@v5
with:
go-version: '1.20.1'
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Build ethereum smart-contracts
run: forge build
working-directory: ./ethereum
- name: Build
run: cargo build --release --all-targets
lints:
runs-on: kuberunner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install golang
uses: actions/setup-go@v5
with:
go-version: '1.20.1'
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Build ethereum smart-contracts
run: forge build
working-directory: ./ethereum
- name: Run clippy
run: cargo clippy --release --all-targets -- -D warnings $(cat .lints | cut -f1 -d"#" | tr '\n' ' ')
- name: Run rustfmt
run: cargo fmt -- --check
tests:
runs-on: kuberunner
env:
NODE_CONTAINER_NAME: gear_node${{ github.run_id }}_${{ github.run_number }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install golang
uses: actions/setup-go@v5
with:
go-version: '1.20.1'
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Build ethereum smart-contracts
run: forge build
working-directory: ./ethereum
- name: Pull & run Gear node container
run: |
docker pull ghcr.io/gear-tech/node:v1.6.2
docker run --name $NODE_CONTAINER_NAME --detach --rm --publish 127.0.0.1:9944:9944 ghcr.io/gear-tech/node:v1.6.2 gear --dev --tmp --rpc-external
- name: Run tests
run: cargo test --release --workspace
--exclude prover
--exclude plonky2_blake2b256
--exclude plonky2_ecdsa
--exclude plonky2_ed25519
--exclude plonky2_sha512
--exclude plonky2_u32 || { exit_code=$?; if [ x$exit_code != x0 ]; then docker stop $NODE_CONTAINER_NAME; fi; exit $exit_code; }
- name: Run solidity tests
run: |
cd ethereum
forge test
- name: Stop Gear node container (if any)
continue-on-error: true
run: docker stop $NODE_CONTAINER_NAME
check-zk-circuits-changed:
runs-on: kuberunner
outputs:
circuits_changed: ${{ steps.filter.outputs.circuits }}
prover_changed: ${{ steps.filter.outputs.prover }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Filter files
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
circuits:
- 'circuits/**'
prover:
- 'prover/**'
zk-tests:
runs-on: kuberunner
needs: check-zk-circuits-changed
if: ${{needs.check-zk-circuits-changed.outputs.circuits_changed == 'true' || needs.check-zk-circuits-changed.outputs.prover_changed == 'true'}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run tests
run: cargo test --release
-p prover
-p plonky2_blake2b256
-p plonky2_ecdsa
-p plonky2_ed25519
-p plonky2_sha512
-p plonky2_u32
check-api-files:
runs-on: kuberunner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install golang
uses: actions/setup-go@v5
with:
go-version: '1.20.1'
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-4923529c743f25a0f37503a7bcf7c68caa6901f1
- name: Build ethereum smart-contracts
run: forge build --force --no-cache
working-directory: ./ethereum
- name: Build workspace
run: cargo build --release --all-targets
- name: Check that files match
run: |
stored=(
"./api/ethereum/ERC20ManagerBridgingPayment.json"
"./api/ethereum/IERC20Manager.json"
"./api/ethereum/IMessageQueue.json"
"./api/gear/bridging_payment.idl"
"./api/gear/erc20_relay.idl"
"./api/gear/vft_manager.idl"
"./api/gear/wrapped_vara.idl"
"./api/gear/extended_vft.idl"
)
generated=(
"./ethereum/out/ERC20Manager.sol/ERC20ManagerBridgingPayment.json"
"./ethereum/out/IERC20Manager.sol/IERC20Manager.json"
"./ethereum/out/IMessageQueue.sol/IMessageQueue.json"
"./target/wasm32-unknown-unknown/release/bridging_payment.idl"
"./target/wasm32-unknown-unknown/release/erc20_relay.idl"
"./target/wasm32-unknown-unknown/release/vft_manager.idl"
"./target/wasm32-unknown-unknown/release/wrapped_vara.idl"
"./target/wasm32-unknown-unknown/release/extended_vft.idl"
)
for i in "${!stored[@]}"; do
if ! cmp -s "${stored[$i]}" "${generated[$i]}"; then
echo "API files ${stored[$i]} and ${generated[$i]} don't match."
diff "${stored[$i]}" "${generated[$i]}"
exit 1
fi
done