BundleCraft PyTest Suite - Run #379 #379
Workflow file for this run
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: 🧪 BundleCraft PyTest Suite | |
| run-name: 'BundleCraft PyTest Suite - Run #${{ github.run_number }}' | |
| on: | |
| push: | |
| branches: [main, pre-release] | |
| pull_request: | |
| branches: [main, pre-release] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate-lock-file: | |
| name: 🔒 Validate Requirements Lock File | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: 🧾 Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: 🐍 Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: 📦 Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install pip-tools first to ensure compatibility | |
| pip install "pip-tools>=7.4.1" | |
| pip install -e ".[dev]" | |
| - name: 🔍 Check if lock file is a placeholder | |
| id: check-placeholder | |
| run: | | |
| if grep -q "IMPORTANT: This file must be properly generated" requirements-lock.txt; then | |
| echo "placeholder=true" >> $GITHUB_OUTPUT | |
| echo "⚠️ Lock file is a placeholder - skipping validation" | |
| else | |
| echo "placeholder=false" >> $GITHUB_OUTPUT | |
| echo "✅ Lock file appears to be generated - validating" | |
| fi | |
| - name: 🔍 Validate lock file exists | |
| run: | | |
| if [ ! -f requirements-lock.txt ]; then | |
| echo "❌ requirements-lock.txt not found" | |
| echo "Run 'make lock-requirements' to generate it" | |
| exit 1 | |
| fi | |
| echo "✅ requirements-lock.txt exists" | |
| - name: 🔍 Validate lock file is up-to-date | |
| if: steps.check-placeholder.outputs.placeholder == 'false' | |
| run: | | |
| # Generate a temporary lock file to compare | |
| pip-compile pyproject.toml --output-file=requirements-lock-check.txt --resolver=backtracking --strip-extras --quiet | |
| # Compare with existing lock file (ignore comments and blank lines) | |
| if ! diff -u <(grep -v '^#' requirements-lock.txt | grep -v '^$' | sort) \ | |
| <(grep -v '^#' requirements-lock-check.txt | grep -v '^$' | sort) > lock-diff.txt; then | |
| echo "❌ Lock file is out of date!" | |
| echo "" | |
| echo "Differences found:" | |
| cat lock-diff.txt | |
| echo "" | |
| echo "To fix this, run:" | |
| echo " make lock-requirements" | |
| echo " git add requirements-lock.txt" | |
| echo " git commit -m 'chore: update requirements lock file'" | |
| exit 1 | |
| fi | |
| echo "✅ Lock file is up-to-date" | |
| rm requirements-lock-check.txt | |
| - name: ℹ️ Placeholder notice | |
| if: steps.check-placeholder.outputs.placeholder == 'true' | |
| run: | | |
| echo "::notice title=Lock File::requirements-lock.txt is a placeholder. Generate it with 'make lock-requirements' before production release." | |
| test: | |
| name: 🧪 PyTest Suite | |
| runs-on: ubuntu-latest | |
| needs: validate-lock-file | |
| permissions: | |
| contents: read | |
| # Only run on push if it's NOT a PR merge commit | |
| if: | | |
| github.event_name == 'pull_request' || | |
| (github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'Merge pull request')) | |
| steps: | |
| - name: 🧾 Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: 🐍 Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: 📦 Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install pip-tools first to ensure compatibility | |
| pip install "pip-tools>=7.4.1" | |
| pip install -e ".[dev]" | |
| - name: 🧪 Run pytest with coverage | |
| run: pytest -v --tb=short --cov --cov-branch --cov-report=xml | |
| - name: 📈 Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |