When modifying CI workflows, keep pipelines deterministic, resource-efficient, and transparent:
needs: unit-tests).conftest.py) via unexpected directory nesting. Fail fast with clear error messages.Example pattern (job gating):
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pytest -m unit
integration-tests:
needs: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pytest -m integration
Example pattern (deterministic discovery):
nested=$(find t/integration -mindepth 2 -name 'test_*.py')
if [ -n "$nested" ]; then
echo "::error::Integration test files must live at t/integration/ root, not in subdirectories: $nested"
exit 1
fi
Enter the URL of a public GitHub repository