-
Notifications
You must be signed in to change notification settings - Fork 55
174 lines (162 loc) · 6.83 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
name: continuous-integration/examples
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- '**.gitignore'
- '.images/**'
- '**README.md'
pull_request:
branches:
- main
paths-ignore:
- '**.gitignore'
- '.images/**'
- '**README.md'
jobs:
check:
name: examples
strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
toolchain:
- stable
contract:
- basic-contract-caller
- call-runtime
- conditional-compilation
- contract-terminate
- custom-allocator
- custom-environment
- dns
- e2e-call-runtime
- erc20
- erc721
- erc1155
- flipper
- incrementer
- multi-contract-caller
- multi-contract-caller/accumulator
- multi-contract-caller/adder
- multi-contract-caller/subber
- multisig
- payment-channel
- psp22-extension
- rand-extension
- trait-dyn-cross-contract-calls
- trait-erc20
- trait-flipper
- trait-incrementer
- upgradeable-contracts/delegator
- upgradeable-contracts/set-code-hash
- vesting
runs-on: ${{ matrix.platform }}
env:
MULTI_CONTRACT_CALLER_SUBCONTRACTS: "accumulator adder subber"
UPGRADEABLE_CONTRACTS: "delegator set-code-hash"
WORKSPACE_CONTRACTS: "erc20,flipper,incrementer"
RUST_BACKTRACE: full
steps:
- name: Checkout sources & submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Install toolchain
id: toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rust-src
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
with:
cache-on-failure: true
workspaces: ${{ matrix.contract }}
key: ${{ matrix.contract }}
- name: Install `cargo-contract` `main`
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: cargo-contract
git: https://github.com/paritytech/cargo-contract.git
cache-key: ${{ matrix.platform }}
- name: Install cargo-dylint
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: cargo-dylint
version: 1
- name: Install dylint-link
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: dylint-link
version: 1
- name: Download and run latest `substrate-contracts-node` binary
if: runner.os == 'Linux'
run: |
curl -L -o substrate-contracts-node.zip 'https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/jobs/artifacts/main/download?job=build-linux' && \
unzip substrate-contracts-node.zip && \
chmod +x artifacts/substrate-contracts-node-linux/substrate-contracts-node &&
./artifacts/substrate-contracts-node-linux/substrate-contracts-node -linfo,runtime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
- name: Download and run latest `substrate-contracts-node` binary
if: runner.os == 'macOS'
run: |
curl -L -o substrate-contracts-node.zip 'https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/jobs/artifacts/main/download?job=build-mac' && \
unzip substrate-contracts-node.zip && \
chmod +x artifacts/substrate-contracts-node-mac/substrate-contracts-node &&
./artifacts/substrate-contracts-node-mac/substrate-contracts-node -linfo,runtime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
- name: Install and run latest `substrate-contracts-node` binary
if: runner.os == 'Windows'
run: |
cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git --force --locked && \
substrate-contracts-node -lruntime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
- name: Output versions
run: |
cargo -vV
cargo contract --version
- name: Build ${{ matrix.contract }} examples on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: runner.os == 'Windows'
run: |
$multi_contract_caller_subcontracts = "accumulator","adder","subber"
foreach ($contract in $multi_contract_caller_subcontracts) {
echo "Processing multi-contract-caller contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path multi-contract-caller/${contract}/Cargo.toml;
}
$upgradeable_contracts = "delegator","set-code-hash"
foreach ($contract in $upgradeable_contracts) {
echo "Processing upgradeable contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path upgradeable-contracts/${contract}/Cargo.toml;
}
$workspace_contracts = "erc20","flipper","incrementer"
foreach ($contract in $workspace_contracts) {
echo "Processing workspace contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path workspace-contracts/${contract}/Cargo.toml;
}
foreach ($example in Get-ChildItem -Directory "\*") {
if ($example -Match 'artifacts') { continue }
echo "Processing example: $example";
cargo ${{ matrix.job }} --verbose --manifest-path=$example/Cargo.toml;
cargo clean --manifest-path=$example/Cargo.toml;
}
- name: Build ${{ matrix.contract }} on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: runner.os != 'Windows'
run: cargo contract build --verbose --manifest-path=${{ matrix.contract }}/Cargo.toml;
for contract in ${{ env.WORKSPACE_CONTRACTS }}
do
echo "Processing workspace contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path=workspace-contracts/$contract/Cargo.toml;
done
for example in ./*/; do
if [ "$example" = "./artifacts/" ] || [ "$example" = "./upgradeable-contracts/" ]|| [ "$example" = "./workspace-contracts/" ]; then continue; fi;
echo "Processing example: $example";
cargo ${{ matrix.job }} --verbose --manifest-path=$example/Cargo.toml;
done
- name: Test ${{ matrix.contract }} on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: runner.os != 'Windows'
run: cargo test --verbose --manifest-path=${{ matrix.contract }}/Cargo.toml;