Merge pull request #194 from Tobi-De/dependabot/pip/furo-2025.12.19 #77
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: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: # Allow manual triggering | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test project generation | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.12"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: Run cookiecutter tests | |
| run: | | |
| pytest tests/ -v | |
| test-generated-project: | |
| name: Test generated project | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| database: ["Tortoise", "Beanie"] | |
| use_docker: ["y", "n"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install cookiecutter | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install cookiecutter | |
| - name: Generate project | |
| run: | | |
| cookiecutter . --no-input \ | |
| project_name="Test Project" \ | |
| database="${{ matrix.database }}" \ | |
| use_docker="${{ matrix.use_docker }}" | |
| - name: Check generated project structure | |
| run: | | |
| cd test_project | |
| # Check that key files exist | |
| test -f pyproject.toml | |
| test -f README.md | |
| test -f manage.py | |
| test -d test_project | |
| # Check that package module files exist | |
| test -f test_project/__init__.py | |
| test -f test_project/main.py | |
| test -f test_project/health.py | |
| - name: Validate Python syntax | |
| run: | | |
| cd test_project | |
| # Check all Python files for syntax errors | |
| find . -name '*.py' -exec python -m py_compile {} + | |
| - name: Check for template remnants | |
| run: | | |
| cd test_project | |
| # Search for any cookiecutter template variables that weren't replaced | |
| if grep -r '{{cookiecutter' . --include="*.py" --include="*.md" --include="*.toml"; then | |
| echo "Found unreplaced template variables" | |
| exit 1 | |
| fi | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install project dependencies | |
| run: | | |
| cd test_project | |
| uv sync | |
| # Note: Dependencies must install successfully to run the info command test below | |
| - name: Create minimal .env file | |
| run: | | |
| cd test_project | |
| # Create .env with dummy but valid URLs (services don't need to be running) | |
| # The info command validates settings format but doesn't connect to services | |
| cat > .env << EOF | |
| SECRET_KEY=test-secret-key-for-ci-only-do-not-use-in-production | |
| REDIS_URL=redis://localhost:6379/0 | |
| DATABASE_URI=postgresql://postgres:postgres@localhost:5432/test_db | |
| DEFAULT_FROM_EMAIL=noreply@example.com | |
| FIRST_SUPERUSER_EMAIL=admin@example.com | |
| FIRST_SUPERUSER_PASSWORD=changethis123 | |
| EOF | |
| - name: Run info command | |
| run: | | |
| cd test_project | |
| uv run python -m test_project info |