feat(ci): run sdk tests with devnet #196
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-rc3 | |
DEVNET_DUMP_PATH: /devnet-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 \ | |
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: 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: Stop starknet-devnet container | |
if: always() | |
run: docker stop starknet-devnet | |