name: Python Project Tests

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  tests:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Python 3.11
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install Poetry
        uses: snok/install-poetry@v1
        with:
          version: '1.7.1'

      - name: Install dependencies
        run: |
          poetry install --with dev

      - name: Run Python test suites
        run: |
          chmod +x scripts/ci/run_python_tests.sh
          ./scripts/ci/run_python_tests.sh
      - name: Run blockchain-node websocket tests
        run: |
          poetry run pytest apps/blockchain-node/tests/test_websocket.py
