Integration Test #94
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
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 | |
- 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 | |
- 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: Run Anvil | |
run: | | |
anvil --gas-price=0 & | |
# 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 | |
# 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 ${ETH_RPC_URL} | |
# 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 "" | |
# Deploy Ethereum Contract | |
- name: Install Forge | |
run: | | |
cd contracts/solidity | |
forge install | |
# - name: Deploy Ethereum Contract | |
# run: | | |
# export ETH_RPC_URL=${{vars.ETH_RPC_URL}} | |
# export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} | |
# export ETH_PRIVATE_KEY=${{vars.ETH_PRIVATE_KEY}} | |
# export SN_MESSAGING_ADDRESS=${{vars.SN_MESSAGING_ADDRESS}} | |
# export MM_ETHEREUM_WALLET=${{vars.MM_ETHEREUM_WALLET}} | |
# export SKIP_VERIFY=true | |
# make ethereum-deploy | |
# Build Ethereum Contract | |
- name: Build Ethereum Contract | |
run: | | |
make ethereum-build | |
# Build Starknet Contract. It builds escrow and ERC20 contracts | |
- name: Build Starknet Contract | |
run: | | |
make starknet-build | |
# Deploy YABTransfer, ERC20, Escrow, set escrow, set withdraw selector and test complete flow | |
- name: Deploy and test complete flow | |
run: | | |
export ETH_RPC_URL=${{vars.ETH_RPC_URL}} | |
export ETHERSCAN_API_KEY=${{vars.ETHERSCAN_API_KEY}} | |
export ETH_PRIVATE_KEY=${{vars.ETH_PRIVATE_KEY}} | |
export SN_MESSAGING_ADDRESS=${{vars.SN_MESSAGING_ADDRESS}} | |
export MM_ETHEREUM_WALLET=${{vars.MM_ETHEREUM_WALLET}} | |
export SKIP_VERIFY=true | |
. ./contracts/solidity/deploy.sh | |
export STARKNET_RPC=${{vars.STARKNET_RPC}} | |
source ./contracts/cairo/.env.test | |
. ./contracts/cairo/deploy.sh | |
. ./contracts/solidity/set_escrow.sh | |
. ./contracts/solidity/set_withdraw_selector.sh | |
export AMOUNT=1000000000000000000 | |
. ./.github/workflows/scripts/set_order.sh | |
. ./.github/workflows/scripts/transfer.sh | |
. ./.github/workflows/scripts/withdraw.sh | |
. ./.github/workflows/scripts/assert.sh | |
# Run mm-bot (it should run a single process order listening to the contract once) |