-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (139 loc) · 5.74 KB
/
Copy pathci.yml
File metadata and controls
165 lines (139 loc) · 5.74 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Clone LEZ (path dependency of the optional chain feature)
run: |
git clone --depth 1 --branch v0.1.2 \
https://github.com/logos-blockchain/logos-execution-zone.git \
"$GITHUB_WORKSPACE/../lez-build"
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check workspace
run: cargo check --workspace
- name: Clippy
run: cargo clippy --workspace -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Clone LEZ (path dependency of the optional chain feature)
run: |
git clone --depth 1 --branch v0.1.2 \
https://github.com/logos-blockchain/logos-execution-zone.git \
"$GITHUB_WORKSPACE/../lez-build"
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- name: Unit tests (RISC0_DEV_MODE)
env:
RISC0_DEV_MODE: "1"
run: cargo test --workspace -- --test-threads=1
- name: Multisig program state-machine tests
env:
RISC0_DEV_MODE: "1"
run: cargo test --manifest-path programs/multisig/Cargo.toml --lib --tests -- --test-threads=1
e2e-sequencer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Clone LEZ (logos-execution-zone v0.1.2) as sibling lez-build
run: |
git clone --depth 1 --branch v0.1.2 \
https://github.com/logos-blockchain/logos-execution-zone.git \
"$GITHUB_WORKSPACE/../lez-build"
- name: Cache LEZ sequencer build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
../lez-build/target
key: ${{ runner.os }}-lez-v0.1.2-sequencer
- name: Install logos-blockchain-circuits release
run: |
mkdir -p ~/.logos-blockchain-circuits
curl -sfL -o /tmp/circuits.tar.gz \
https://github.com/logos-blockchain/logos-blockchain-circuits/releases/download/v0.4.2/logos-blockchain-circuits-v0.4.2-linux-x86_64.tar.gz
tar -xzf /tmp/circuits.tar.gz -C ~/.logos-blockchain-circuits
# the tarball may nest a versioned directory; surface its contents
inner=$(find ~/.logos-blockchain-circuits -maxdepth 1 -mindepth 1 -type d -name 'logos-blockchain-circuits-*' | head -1)
if [ -n "$inner" ]; then cp -r "$inner"/* ~/.logos-blockchain-circuits/; fi
ls ~/.logos-blockchain-circuits
- name: Build standalone sequencer
run: cargo build --release -p sequencer_service --features standalone
working-directory: ../lez-build
- name: Install r0vm (risc0 executor backend, required at sequencer runtime)
run: |
curl -sfL -o /tmp/crz.tgz \
https://github.com/risc0/risc0/releases/download/v3.0.5/cargo-risczero-x86_64-unknown-linux-gnu.tgz
tar -xzf /tmp/crz.tgz -C "$HOME/.cargo/bin" r0vm
chmod +x "$HOME/.cargo/bin/r0vm"
r0vm --version
- name: Start sequencer
run: |
mkdir -p /tmp/lez-seq-home
RISC0_DEV_MODE=1 RUST_LOG=debug RUST_BACKTRACE=full \
../lez-build/target/release/sequencer_service \
.github/sequencer_config.json -p 3040 > /tmp/lez-seq.log 2>&1 &
for i in $(seq 1 60); do
curl -sf -m 2 -X POST http://127.0.0.1:3040 \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"checkHealth","params":[],"id":1}' \
>/dev/null 2>&1 && exit 0
sleep 2
done
echo "sequencer did not come up"; tail -50 /tmp/lez-seq.log; exit 1
- name: Cache repo build (chain feature)
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-chain-${{ hashFiles('**/Cargo.lock') }}
- name: Build CLI with chain feature
run: cargo build --release --bin multisig --features chain
- name: Deploy programs to local sequencer
run: |
python3 - <<'PYEOF'
import json, base64, struct, urllib.request
def deploy(path):
bytecode = open(path,'rb').read()
tx = bytes([2]) + struct.pack('<I', len(bytecode)) + bytecode
param = base64.b64encode(tx).decode()
req = urllib.request.Request('http://127.0.0.1:3040',
data=json.dumps({'jsonrpc':'2.0','method':'sendTransaction','params':[param],'id':1}).encode(),
headers={'Content-Type':'application/json'})
print(path, '->', json.loads(urllib.request.urlopen(req, timeout=60).read())['result'])
deploy('programs/multisig/private_multisig.bin')
deploy('programs/vote_circuit/vote_circuit.bin')
PYEOF
sleep 12
- name: Full e2e demo against the sequencer (initialize, proposal, 2 PPE votes, execute)
env:
SEQUENCER: http://127.0.0.1:3040
run: ./demo.sh --dev --chain
- name: Sequencer log on failure
if: failure()
run: tail -100 /tmp/lez-seq.log