Update README.md #10
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: Security Checks | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 0 * * 0' # Run weekly on Sunday at midnight | |
| workflow_dispatch: | |
| jobs: | |
| security-scans: | |
| name: Security Scans | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| pip install bandit pylint safety | |
| - name: Run Bandit | |
| run: bandit -r src/ -f json -o bandit-results.json | |
| continue-on-error: true | |
| - name: Run Pylint | |
| run: pylint --disable=C0111,C0103 --generate-rcfile > .pylintrc && pylint src/ --output-format=json:pylint-results.json | |
| continue-on-error: true | |
| - name: Run Safety dependency check | |
| run: safety check --full-report --output json > safety-results.json | |
| continue-on-error: true | |
| - name: Upload Security Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: security-results | |
| path: | | |
| bandit-results.json | |
| pylint-results.json | |
| safety-results.json | |
| - name: Run test coverage | |
| run: | | |
| pip install coverage pytest | |
| coverage run -m pytest tests/ | |
| coverage xml -o coverage.xml | |
| continue-on-error: true | |
| - name: SonarCloud Scan | |
| uses: SonarSource/sonarqube-scan-action@master | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| with: | |
| args: > | |
| -Dsonar.projectKey=teabranch_openai-responses-server | |
| -Dsonar.organization=${{ github.repository_owner }} | |
| -Dsonar.python.coverage.reportPaths=coverage.xml | |
| -Dsonar.python.bandit.reportPaths=bandit-results.json | |
| -Dsonar.python.pylint.reportPaths=pylint-results.json | |
| dependency-review: | |
| name: Dependency Review | |
| # Only run on pull requests where base_ref and head_ref are available | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Dependency Review | |
| uses: actions/dependency-review-action@v3 | |
| with: | |
| fail-on-severity: high | |
| codeql-analysis: | |
| name: CodeQL Analysis | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v2 | |
| with: | |
| languages: python | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 |