-
Notifications
You must be signed in to change notification settings - Fork 9
135 lines (110 loc) · 3.93 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
name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule: [cron: "40 1 * * *"]
permissions:
contents: read
env:
RUSTFLAGS: -Dwarnings
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: rust version
run: |
rustc --version
cargo --version
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-nextest
- name: feature compatibility
run: make check-features
- name: rustfmt
run: make check-fmt
- name: clippy
run: make clippy
- name: Run tests
run: make test
- name: rustdoc
run: make doc
wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: rust version
run: |
rustup default 1.81.0
rustc --version
cargo --version
- uses: taiki-e/install-action@wasm-pack
- name: Install clang
run: sudo apt-get install -y clang
- name: Run tests in wasm
run: make wasm
run_tests_with_network:
runs-on: ubuntu-latest
env:
EPOCH_DURATION_MS: 10000
services:
postgres: # we need this postgres instance for running a local network with indexer and graphql
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgrespw
POSTGRES_DB: sui_indexer_v2
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: rust version
run: |
rustc --version
cargo --version
- uses: taiki-e/install-action@cargo-nextest
- name: Get the Sui testnet binary and start a local network
shell: bash
env:
SUI_BINARY_VERSION: "1.36.1" # used for downloading a specific Sui binary versions that matches the GraphQL schema for local network tests
SUI_NETWORK_RELEASE: "testnet" # which release to use
run: |
ASSET_NAME="sui-$SUI_NETWORK_RELEASE-v$SUI_BINARY_VERSION-ubuntu-x86_64.tgz"
download_url="https://github.com/mystenlabs/sui/releases/download/$SUI_NETWORK_RELEASE-v$SUI_BINARY_VERSION/$ASSET_NAME"
echo "Downloading testnet binary from $download_url"
wget -q $download_url -O sui.tgz
tar -zxvf sui.tgz ./sui
chmod +x ./sui
echo "Starting local network with a faucet, an indexer (port 5432) and GraphQL. Epoch duration is set to $EPOCH_DURATION_MS ms"
echo "$(pwd)" >> $GITHUB_PATH # we need it on the path for calling sui move build for some tests
./sui start --force-regenesis --with-faucet --with-indexer --with-graphql --pg-port 5432 --pg-db-name sui_indexer_v2 --epoch-duration-ms $EPOCH_DURATION_MS &
- name: Set up the CLI environment (need a client.yaml for calling some Sui commands)
shell: bash
run: |
mkdir -p $HOME/.sui/sui_config
tee $HOME/.sui/sui_config/client.yaml <<EOF
---
keystore:
File: home/.sui/sui_config/sui.keystore
envs:
- alias: localnet
rpc: "http://127.0.0.1:9000"
ws: ~
active_env: localnet
active_address: "0x14e7ac25259adcc373c96627893976d4fe562a3f3fedce493fc187c5ebd53eee"
EOF
- name: Run tests that require local network (GraphQL Client and Tx Builder)
env:
NETWORK: "local" # other expected options are mainnet, testnet, or devnet, or an actual URL to a GraphQL server: http://localhost:port
run: |
sleep $((EPOCH_DURATION_MS / 1000)) # wait for the network to get to epoch #2
make test-with-localnet