name: Run test_game.py

on:
  schedule:
    - cron: '0 0 */3 * *'
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Debug directory structure
        run: |
          # ✅ Show actual directory structure
          echo "Current directory: $(pwd)"
          ls -la

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.10

      - name: Install dependencies
        run: |
          cd games/game_werewolves
          pip install pytest pytest-asyncio
          pip install -r requirements.txt

      - name: Run game_test.py
        env:
          DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
          PYTHONPATH: ${{ env.GITHUB_WORKSPACE }}/games/game_werewolves
        run: |
          # ✅ Ensure correct working directory
          python -m pytest tests/game_test.py -v