Skip to content

Commit

Permalink
CI: run SDK test with devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
ptisserand committed Sep 14, 2024
1 parent 900e9c2 commit c45e200
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 48 deletions.
44 changes: 44 additions & 0 deletions .env.devnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Starknet RPC URL
STARKNET_RPC_URL=http://0.0.0.0:5050

## starknet-devnet-rs 0.2.0 account --seed 0
# Starknet accounts
STARKNET_ADMIN_ADDRESS_DEV=0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691
STARKNET_ADMIN_PRIVATE_KEY_DEV=0x0000000000000000000000000000000071d7bb07b9a64f6f78ac4c816aff4da9

STARKNET_ACCOUNT1_ADDRESS=0x78662e7352d062084b0010068b99288486c2d8b914f6e2a55ce945f8792c8b1
STARKNET_ACCOUNT1_PRIVATE_KEY=0x000000000000000000000000000000000e1406455b7d66b1690803be066cbe5e
STARKNET_ACCOUNT1_PUBLIC_KEY=0x007a1bb2744a7dd29bffd44341dbd78008adb4bc11733601e7eddff322ada9cb

STARKNET_ACCOUNT2_ADDRESS=0x49dfb8ce986e21d354ac93ea65e6a11f639c1934ea253e5ff14ca62eca0f38e
STARKNET_ACCOUNT2_PRIVATE_KEY=0x00000000000000000000000000000000a20a02f0ac53692d144b20cb371a60d7
STARKNET_ACCOUNT2_PUBLIC_KEY=0x00b8fd4ddd415902d96f61b7ad201022d495997c2dff8eb9e0eb86253e30fabc

STARKNET_ARK_RECEIVER_ADDRESS=0x4f348398f859a55a0c80b1446c5fdc37edb3a8478a32f10764659fc241027d3
STARKNET_ARK_RECEIVER_PRIVATE_KEY=0x00000000000000000000000000000000a641611c17d4d92bd0790074e34beeb7

STARKNET_ARK_COLLECTION_RECEIVER_ADDRESS=0xd513de92c16aa42418cf7e5b60f8022dbee1b4dfd81bcf03ebee079cfb5cb5
STARKNET_ARK_COLLECTION_RECEIVER_PRIVATE_KEY=0x000000000000000000000000000000005b4ac23628a5749277bcabbf4726b025

STARKNET_ARK_COLLECTION_2981_RECEIVER_ADDRESS=0x1e8c6c17efa3a047506c0b1610bd188aa3e3dd6c5d9227549b65428de24de78
STARKNET_ARK_COLLECTION_2981_RECEIVER_PRIVATE_KEY=0x00000000000000000000000000000000836203aceb0e9b0066138c321dda5ae6

STARKNET_LISTING_BROKER_ACCOUNT_ADDRESS=0x557ba9ef60b52dad611d79b60563901458f2476a5c1002a8b4869fcb6654c7e
STARKNET_LISTING_BROKER_ACCOUNT_PRIVATE_KEY=0x0000000000000000000000000000000015b5e3013d752c909988204714f1ff35

STARKNET_SALE_BROKER_ACCOUNT_ADDRESS=0x3736286f1050d4ba816b4d56d15d80ca74c1752c4e847243f1da726c36e06f
STARKNET_SALE_BROKER_ACCOUNT_PRIVATE_KEY=0x00000000000000000000000000000000a56597ba3378fa9e6440ea9ae0cf2865

SOLIS_ADMIN_ADDRESS_DEV=0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca
SOLIS_ADMIN_PRIVATE_KEY_DEV=0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a
SOLIS_ADMIN_PUBLIC_KEY_DEV=0x640466ebd2ce505209d3e5c4494b4276ed8f1cde764d757eb48831961f7cdea

SOLIS_ADMIN_ADDRESS=0x6b86e40118f29ebe393a75469b4d926c7a44c2e2681b6d319520b7c1156d114
SOLIS_ADMIN_PRIVATE_KEY=0x1c9053c053edf324aec366a34c6901b1095b07af69495bffec7d7fe21effb1b

# Starknet network
STARKNET_NETWORK_ID=dev
# Solis network
SOLIS_NETWORK_ID=dev

BROKER_ID=
34 changes: 34 additions & 0 deletions .github/actions/install-snforge/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Install contract dependencies"
description: "Install dependencies for smart contract"

env:
SCARB_VERSION: 2.7.1
STARKNET_FOUNDRY_VERSION: 0.30.0

runs:
using: "composite"
steps:
- name: Install universal sierra compiler
run: |
curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh
echo "/root/.local/bin" >> ${GITHUB_PATH}
- name: Check universal sierra compiler version
run: universal-sierra-compiler --version

- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ env.SCARB_VERSION }}

- name: Setup Starknet Foundry
uses: foundry-rs/setup-snfoundry@v3
with:
starknet-foundry-version: ${{ env.STARKNET_FOUNDRY_VERSION }}

- name: Set Up Stable Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

75 changes: 51 additions & 24 deletions .github/workflows/arkproject-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,74 @@ on:
paths:
- "contracts/**"

env:
SCARB_VERSION: 2.7.1
STARKNET_DEVNET_VERSION: 0.2.0-rc3
DEVNET_DUMP_PATH: /devnet-dump.json
jobs:
fmt:
runs-on: ubuntu-latest
name: Cairo formatting
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install universal sierra compiler
run: curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh
uses: actions/checkout@v4

- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: 2.7.1
scarb-version: ${{ env.SCARB_VERSION }}

- name: Check Scarb Formatting
run: cd contracts && scarb fmt --check
test:

forge-test:
runs-on: ubuntu-latest
name: Cairo starknet foundry tests
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install universal sierra compiler
run: curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh
- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: 2.7.1
uses: actions/checkout@v4

- name: Setup Starknet Foundry
uses: foundry-rs/setup-snfoundry@v2
with:
starknet-foundry-version: 0.28.0
- name: Install starknet foundry & dependencies
uses: ./.github/actions/install-snforge

- name: Test contracts
run: cd contracts && snforge test

devnet-test:
runs-on: ubuntu-latest
name: Running SDK test with starknet-devnet
# needs: forge-test
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install starknet foundry & dependencies
uses: ./.github/actions/install-snforge

- name: Build smart contracts
run: cd contracts && scarb build --workspace

- name: Run starknet-devnet as a background process
run: |
docker run -d --rm --name starknet-devnet \
-p 5050:5050 \
ptisserand/starknet-devnet-rs:${STARKNET_DEVNET_VERSION} \
--seed 0 --dump-path $DEVNET_DUMP_PATH --state-archive-capacity full
sleep 3 # Wait for 3 seconds for the Docker container to initialize
- name: Test ark_common contracts
run: cd contracts/ark_common && snforge test
- name: Install SDK dependencies
uses: ./.github/actions/install-dependencies

- name: Deploy smart contract
run: pnpm deploy:starknet:local

- name: Run SDK test
run: |
cp .env.devnet .env
pnpm test
- name: Test ark_orderbook contracts
run: cd contracts/ark_orderbook && snforge test
- name: Stop starknet-devnet container
if: always()
run: docker stop starknet-devnet

- name: Test ark_starknet contracts
run: cd contracts/ark_starknet && snforge test

- name: Test ark_tokens contracts
run: cd contracts/ark_tokens && snforge test
Loading

0 comments on commit c45e200

Please sign in to comment.