-
Notifications
You must be signed in to change notification settings - Fork 441
135 lines (122 loc) · 5.61 KB
/
examples.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
name: continuous-intergration/examples
on:
push:
branches:
- master
tags:
- v*
paths-ignore:
- 'README.md'
pull_request:
branches:
- master
paths:
- '.github/workflows/examples.yml'
jobs:
check:
name: examples
strategy:
matrix:
platform:
- macos-latest
- windows-latest
toolchain:
- stable
job:
- contract build
- test
runs-on: ${{ matrix.platform }}
env:
UPGRADEABLE_CONTRACTS: "forward-calls set-code-hash"
DELEGATOR_SUBCONTRACTS: "accumulator adder subber"
RUST_BACKTRACE: full
steps:
- name: Checkout sources & submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Install toolchain
id: toolchain
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # Master branch, Rust up to 1.74.1
with:
toolchain: ${{ matrix.toolchain }}
components: rust-src
- name: Install cargo-dylint
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: cargo-dylint
version: 1
- name: Install dylint-link
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: dylint-link
version: 1
- name: Download and run latest `substrate-contracts-node` binary
if: matrix.os == 'macOS-latest'
env:
CONTRACTS_NODE_URL: https://github.com/paritytech/substrate-contracts-node/releases/latest/download/substrate-contracts-node-
CONTRACTS_NODE_OS: mac-universal
run: |
curl -L -o substrate-contracts-node.tar.gz "$CONTRACTS_NODE_URL$CONTRACTS_NODE_OS.tar.gz" && \
tar xfzv substrate-contracts-node.tar.gz && \
chmod +x artifacts/substrate-contracts-node-*/substrate-contracts-node && \
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: matrix.os == 'windows-latest'
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: Rust Cache
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
- name: Install `cargo-contract` `master`
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: cargo-contract
git: https://github.com/use-ink/cargo-contract.git
branch: master
- name: Output versions
run: |
cargo -vV
cargo contract --version
- name: ${{ matrix.job }} examples on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: matrix.os == 'windows-latest'
run: |
$delegator_subcontracts = "accumulator","adder","subber"
foreach ($contract in $delegator_subcontracts) {
echo "Processing delegator contract: $contract";
cargo ${{ matrix.job }} --manifest-path integration-tests/delegator/${contract}/Cargo.toml;
}
$upgradeable_contracts = "forward-calls","set-code-hash"
foreach ($contract in $upgradeable_contracts) {
echo "Processing upgradeable contract: $contract";
cargo ${{ matrix.job }} --manifest-path integration-tests/upgradeable-contracts/${contract}/Cargo.toml;
}
cargo ${{ matrix.job }} --manifest-path integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
foreach ($example in Get-ChildItem -Directory "integration-tests\*") {
if ($example -Match 'upgradeable-contracts') { continue }
if ($example -Match 'lang-err-integration-tests') { continue }
echo "Processing example: $example";
cargo ${{ matrix.job }} --manifest-path=$example/Cargo.toml;
cargo clean --manifest-path=$example/Cargo.toml;
}
- name: ${{ matrix.job }} integration-tests on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: matrix.os == 'macOS-latest'
run: |
for contract in ${DELEGATOR_SUBCONTRACTS}; do
echo "Processing delegator contract: $contract";
cargo ${{ matrix.job }} --manifest-path integration-tests/delegator/${contract}/Cargo.toml;
done
for contract in ${UPGRADEABLE_CONTRACTS}; do
echo "Processing upgradeable contract: $contract";
cargo ${{ matrix.job }} --manifest-path=integration-tests/upgradeable-contracts/$contract/Cargo.toml;
done
cargo ${{ matrix.job }} --manifest-path=integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
echo "Processing example: $example";
cargo ${{ matrix.job }} --manifest-path=$example/Cargo.toml;
done