fix: align SDK with perpcity-contracts v0.0.1 #6
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Check linting | |
| run: ruff check src/ tests/ | |
| - name: Check formatting | |
| run: ruff format --check src/ tests/ | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Build wheel | |
| run: | | |
| pip install build | |
| python -m build | |
| - name: Check build artifacts | |
| run: | | |
| ls -la dist/ | |
| test -f dist/*.whl | |
| test -f dist/*.tar.gz | |
| - name: Run unit tests | |
| run: pytest tests/unit -v | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check if secrets are available | |
| id: secrets-check | |
| env: | |
| RPC_SECRET: ${{ secrets.BASE_SEPOLIA_RPC_URL }} | |
| run: | | |
| if [ -z "$RPC_SECRET" ]; then | |
| echo "::warning::Integration test secrets not configured - skipping" | |
| echo "has_secrets=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Integration test configuration found - running tests" | |
| echo "has_secrets=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install Foundry | |
| if: steps.secrets-check.outputs.has_secrets == 'true' | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Setup Python | |
| if: steps.secrets-check.outputs.has_secrets == 'true' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| if: steps.secrets-check.outputs.has_secrets == 'true' | |
| run: pip install -e ".[dev]" | |
| - name: Create .env.local for integration tests | |
| if: steps.secrets-check.outputs.has_secrets == 'true' | |
| env: | |
| RPC_URL_VAL: ${{ secrets.BASE_SEPOLIA_RPC_URL }} | |
| PRIVATE_KEY_VAL: ${{ secrets.TEST_PRIVATE_KEY }} | |
| PERP_MANAGER_VAL: ${{ vars.PERP_MANAGER_ADDRESS }} | |
| USDC_VAL: ${{ vars.USDC_ADDRESS }} | |
| PERP_ID_VAL: ${{ vars.TEST_PERP_ID }} | |
| run: | | |
| cat > .env.local << EOF | |
| RPC_URL=${RPC_URL_VAL} | |
| PRIVATE_KEY=${PRIVATE_KEY_VAL} | |
| PERP_MANAGER_ADDRESS=${PERP_MANAGER_VAL} | |
| USDC_ADDRESS=${USDC_VAL} | |
| CHAIN_ID=84532 | |
| TEST_PERP_ID=${PERP_ID_VAL} | |
| EOF | |
| - name: Run integration tests | |
| if: steps.secrets-check.outputs.has_secrets == 'true' | |
| env: | |
| RPC_URL: ${{ secrets.BASE_SEPOLIA_RPC_URL }} | |
| PRIVATE_KEY: ${{ secrets.TEST_PRIVATE_KEY }} | |
| PERP_MANAGER_ADDRESS: ${{ vars.PERP_MANAGER_ADDRESS }} | |
| USDC_ADDRESS: ${{ vars.USDC_ADDRESS }} | |
| TEST_PERP_ID: ${{ vars.TEST_PERP_ID }} | |
| run: pytest tests/integration -v -m integration | |
| - name: Clean up .env.local | |
| if: always() | |
| run: rm -f .env.local |