Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Katana addition #77

Merged
merged 10 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/run_scripts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Run scripts

on: pull_request

jobs:
run_scripts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y

- name: Install dojoup
run: |
curl -L https://install.dojoengine.org | bash

- name: Install dojo
run: |
/home/runner/.config/.dojo/bin/dojoup
sudo mv /home/runner/.config/.dojo/bin/katana /usr/local/bin/

- name: Make script executable
run: chmod +x scripts/katana.sh

# Set up Node
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20.x"

# Install Node dependencies
- name: Install dependencies
run: npm install
working-directory: ./scripts

# Set up Scarb
- uses: software-mansion/setup-scarb@v1
- run: scarb build

# Run Katana and scripts
- name: Run Katana and scripts
env:
KATANA_ACCOUNT_ADDRESS: ${{ secrets.KATANA_ACCOUNT_ADDRESS }}
KATANA_PRIVATE_KEY: ${{ secrets.KATANA_PRIVATE_KEY }}
run: bash scripts/katana.sh
17 changes: 17 additions & 0 deletions scripts/katana.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Find available port using Python
PORT=$(python3 -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')

echo "Starting katana on port $PORT"
katana --chain-id SN_SEPOLIA --host 127.0.0.1 --port $PORT --accounts "1" --seed "1" &

while ! nc -z localhost $PORT; do
sleep 0.1 # wait for 1/10 of the second before check again
done

# Run your Python script
echo "Running deploy_vault.js with port $PORT"
ls
node ./scripts/test_script.js $PORT
# STARKNET_NETWORK=katana poetry run python3 scripts/deploy_vault.py --port $PORT
Loading
Loading