name: Self Contracts CI/CD
on:
  push:
    branches:
      - dev
      - main
    paths:
      - 'contracts/**'
      - 'common/**'
  pull_request:
    branches:
      - dev
      - main
    paths:
      - 'contracts/**'
      - 'common/**'
jobs:
  test_contracts:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    environment: development
    steps:
      - uses: actions/checkout@v4

      - name: Set Node.js 20.x
        uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Install Dependencies
        uses: ./.github/actions/yarn-install
      - name: Prettier Check - Code Formatting
        run: yarn prettier:check
        working-directory: ./contracts
      - name: Build Common Dependencies
        run: yarn workspace @selfxyz/common build
      - name: Build Contracts
        run: yarn build
        working-directory: ./contracts
      - name: Run Tests (Contracts)
        working-directory: ./contracts
        # skip until they get fixed
        if: false
        run: yarn test
