Add semgrep action and workflow #39
This file contains 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 Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
- "feature/**" | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
- "LICENSE" | |
permissions: | |
contents: read | |
security-events: write | |
checks: write | |
jobs: | |
quality: | |
name: Code Quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run pre-commit checks | |
uses: ./.github/actions/code-quality/pre-commit | |
with: | |
python-version: "3.10" | |
node-version: "18.15.0" | |
# Optionally configure other inputs | |
# skip: "ruff" | |
# cache: "false" | |
unit-tests: | |
name: Unit Tests (Python ${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run unit tests | |
uses: ./.github/actions/pytest | |
with: | |
python-version: ${{ matrix.python-version }} | |
test-type: "unit" | |
codecov-token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Unit Test Results (Python ${{ matrix.python-version }}) | |
path: | | |
pytest.xml | |
coverage.xml | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run integration tests | |
uses: ./.github/actions/pytest | |
with: | |
test-type: "integration" | |
codecov-token: ${{ secrets.CODECOV_TOKEN }} | |
publish-test-results: | |
name: Publish Test Results | |
needs: [unit-tests, integration-tests] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Download Test Results | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: Unit Test Results* | |
merge-multiple: true | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "pytest.xml" | |
comment_mode: "off" | |
security: | |
name: Security Checks | |
uses: ./.github/workflows/security-checks.yaml | |
with: | |
tools: "bandit,semgrep" | |
scan_scope: "changed" | |
severity_level: "medium" | |
fail_on_findings: true |