feat(contract): devnet testing and new events support #199
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: ArkProject contracts ci | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "contracts/**" | |
pull_request: | |
paths: | |
- "contracts/**" | |
env: | |
SCARB_VERSION: 2.7.1 | |
STARKNET_DEVNET_VERSION: 0.2.0 | |
DEVNET_DUMP_PATH: /devnet-dump.json | |
DEVNET_DEPLOYMENT_DUMP_PATH: /tmp/devnet-deployment-dump.json | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
name: Cairo formatting | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Scarb | |
uses: software-mansion/setup-scarb@v1 | |
with: | |
scarb-version: ${{ env.SCARB_VERSION }} | |
- name: Check Scarb Formatting | |
run: cd contracts && scarb fmt --check | |
forge-test: | |
runs-on: ubuntu-latest | |
name: Cairo starknet foundry tests | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- 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 \ | |
shardlabs/starknet-devnet-rs:${STARKNET_DEVNET_VERSION} \ | |
--seed 0 --dump-path $DEVNET_DUMP_PATH --dump-on exit --state-archive-capacity full | |
sleep 3 # Wait for 3 seconds for the Docker container to initialize | |
- name: Install SDK dependencies | |
uses: ./.github/actions/install-dependencies | |
- name: Setup environment for devnet | |
run: cp .env.devnet .env | |
- name: Deploy smart contract | |
run: pnpm deploy:starknet:local | |
- name: Store devnet state after contract deployment | |
run: | | |
curl -H "Content-type: application/json" \ | |
-X POST http://localhost:5050/dump \ | |
-d '{"path": "$DEVNET_DEPLOYMENT_DUMP_PATH"}' | |
- name: Run SDK test | |
run: | | |
cp .env.devnet .env | |
pnpm test --filter=core | |
- name: Stop starknet-devnet container | |
if: always() | |
run: docker stop starknet-devnet | |