Standardize project workflows and testing #1
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: PR Validation | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| jobs: | |
| validate-title: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR title | |
| uses: amannn/action-semantic-pull-request@v5 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| types: | | |
| fix | |
| feat | |
| docs | |
| style | |
| refactor | |
| perf | |
| test | |
| build | |
| ci | |
| chore | |
| revert | |
| check-files: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for large files | |
| run: | | |
| find . -type f -size +1M | grep -v "^./.git" | while read file; do | |
| echo "Error: Large file detected: $file" | |
| exit 1 | |
| done || true | |
| - name: Check for sensitive data | |
| run: | | |
| # Check for potential secrets | |
| grep -r -E "(api[_-]?key|secret|token|password|pwd|passwd)" . \ | |
| --exclude-dir=.git \ | |
| --exclude-dir=node_modules \ | |
| --exclude="*.md" \ | |
| --exclude="*.lock" | grep -v -E "^#|//" || true | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install linters | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff black mypy | |
| - name: Check formatting with black | |
| run: black --check . | |
| - name: Lint with ruff | |
| run: ruff check . | |
| - name: Type check with mypy | |
| run: mypy . --ignore-missing-imports || true | |
| test-coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" || pip install -e . | |
| pip install pytest pytest-cov | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=. --cov-report=term --cov-fail-under=70 || true | |
| security-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install security tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install safety bandit | |
| - name: Security check with safety | |
| run: safety check --json || true | |
| - name: Security check with bandit | |
| run: bandit -r . -f json || true | |
| documentation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check documentation | |
| run: | | |
| # Ensure key documentation files exist | |
| for file in README.md LICENSE AUTHORS.md CONTRIBUTING.md; do | |
| if [ ! -f "$file" ]; then | |
| echo "Warning: $file is missing" | |
| fi | |
| done | |
| - name: Check for broken links in markdown | |
| uses: gaurav-nelson/github-action-markdown-link-check@v1 | |
| with: | |
| use-quiet-mode: 'yes' | |
| config-file: '.github/markdown-link-check-config.json' | |
| continue-on-error: true |