-
Notifications
You must be signed in to change notification settings - Fork 4
179 lines (150 loc) · 5.65 KB
/
integration-test.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
name: Integration Test
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
Test:
runs-on: ubuntu-latest
environment: Test
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres_db # optional (defaults to `postgres`)
POSTGRES_PASSWORD: postgres_password # required
POSTGRES_PORT: 5432 # optional (defaults to `5432`)
POSTGRES_USER: postgres_user # optional (defaults to `postgres`)
# `POSTGRES_HOST` is `localhost`
ports:
- 5432:5432 # maps tcp port 5432 on service container to the host
options: >- # set health checks to wait until postgres has started
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
# Python setup TODO activate when mm-bot is ready
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.10.12
# architecture: x64
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r mm-bot/requirements.txt
# Postgres setup TODO activate when mm-bot is ready
# - name: Install PSQL
# run: |
# sudo apt-get update
# sudo apt-get install --yes postgresql-client
#
# - name: Create tables
# run: |
# psql -h localhost -d postgres_db -U postgres_user -f mm-bot/resources/schema.sql
# psql -h localhost -d postgres_db -U postgres_user -c "SELECT * FROM block;"
# env:
# PGPASSWORD: postgres_password
# Ethereum Setup
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install Forge
run: |
cd contracts/ethereum
forge install
# Starknet Setup
- name: Install scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.3.1"
- name: Install starkliup
run: curl https://get.starkli.sh | sh
- name: Install Starkli
run: |
/home/runner/.config/.starkli/bin/starkliup --version 0.1.20
sudo mv /home/runner/.config/.starkli/bin/starkli /usr/local/bin/
- name: Setup Katana .env
run: |
cp .github/workflows/katana/katana.env .env
- name: Download Katana
run: |
wget https://github.com/dojoengine/dojo/releases/download/v0.4.4/dojo_v0.4.4_linux_amd64.tar.gz
tar -xzvf dojo_v0.4.4_linux_amd64.tar.gz
rm sozo torii dojo-language-server
# Run Anvil
- name: Run Anvil
run: |
anvil &
# Deploy Starknet Messaging Contract in L1
- name: Clone https://github.com/glihm/starknet-messaging-dev
uses: GuillaumeFalourd/[email protected]
with:
branch: 'main'
owner: 'glihm'
repository: 'starknet-messaging-dev'
- name: Install Forge
run: |
cd starknet-messaging-dev/solidity
forge install
- name: Deploy Starknet Messaging Contract
run: |
cd starknet-messaging-dev/solidity
cp anvil.env .env
source .env
forge script script/LocalTesting.s.sol:LocalSetup --broadcast --rpc-url ${{vars.ETHEREUM_RPC}}
# Run Katana
- name: Run Katana
run: |
./katana --messaging starknet-messaging-dev/anvil.messaging.json &
- name: Setup Katana Account
run: |
.github/workflows/scripts/setup_katana_account.sh
# Setup Starknet messaging
- name: Setup Starknet messaging
run: |
cd starknet-messaging-dev/cairo
source katana.env
scarb build
starkli declare ./target/dev/messaging_tuto_contract_msg.contract_class.json --keystore-password ""
starkli deploy 0x02d6b666ade3a9ee98430d565830604b90954499c590fa05a9844bdf4d3a574b \
--salt 0x1234 \
--keystore-password ""
# Build Ethereum Contract
- name: Build Ethereum Contract
run: |
make ethereum-build
# Build Starknet Contract
- name: Build Starknet Contract
run: |
make starknet-build
# Deploy PaymentRegistry, Escrow, set escrow, set claimPayment selector and test complete flow
- name: Deploy and test complete flow
run: |
export ETHEREUM_RPC=${{vars.ETHEREUM_RPC}}
export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}}
export ETHEREUM_PRIVATE_KEY=${{vars.ETHEREUM_PRIVATE_KEY}}
export STARKNET_MESSAGING_ADDRESS=${{vars.STARKNET_MESSAGING_ADDRESS}}
export MM_ETHEREUM_WALLET_ADDRESS=${{vars.MM_ETHEREUM_WALLET_ADDRESS}}
export ZKSYNC_DIAMOND_PROXY_ADDRESS=${{vars.ZKSYNC_DIAMOND_PROXY_ADDRESS}}
export SKIP_VERIFY=true
. ./contracts/ethereum/deploy.sh
export STARKNET_RPC=${{vars.STARKNET_RPC}}
source ./contracts/starknet/.env.test
. ./contracts/starknet/deploy.sh
. ./contracts/ethereum/set_starknet_escrow.sh
. ./contracts/ethereum/set_starknet_claim_payment_selector.sh
export AMOUNT=1000000000000000000
. ./.github/workflows/scripts/set_order.sh
. ./.github/workflows/scripts/transfer.sh
. ./.github/workflows/scripts/claim_payment.sh
. ./.github/workflows/scripts/assert.sh
# Run mm-bot (it should run a single process order listening to the contract once)