Add security fixes, testing infrastructure, and CI/CD improvements
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
name: "CodeQL Security Scanning"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "develop" ]
|
||||
pull_request:
|
||||
branches: [ "main", "develop" ]
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # Run every Monday at midnight
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'python', 'javascript' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
@@ -17,24 +17,40 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install pytest flake8 black mypy pylint
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
# - name: Run Tests
|
||||
# run: pytest tests/
|
||||
- name: Run Tests
|
||||
run: pytest tests/ -v --cov=app --cov-report=xml --cov-report=term
|
||||
|
||||
- name: Upload Coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
fail_ci_if_error: false
|
||||
|
||||
- name: Run Linter (Flake8)
|
||||
run: flake8 app/
|
||||
continue-on-error: true
|
||||
run: flake8 app/ --max-line-length=120 --extend-ignore=E203,W503
|
||||
continue-on-error: false
|
||||
|
||||
- name: Run Code Formatter (Black)
|
||||
run: black --check app/
|
||||
continue-on-error: true
|
||||
run: black --check app/ --line-length=120
|
||||
continue-on-error: false
|
||||
|
||||
- name: Run Type Checker (Mypy)
|
||||
run: mypy app/
|
||||
run: mypy app/ --ignore-missing-imports
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run Linter (Pylint)
|
||||
run: pylint app/
|
||||
run: pylint app/ --max-line-length=120 --disable=C0111,C0103,R0903
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run Security Linter (Bandit)
|
||||
run: bandit -r app/ -ll -f json -o bandit-report.json
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload Bandit Report
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: bandit-report
|
||||
path: bandit-report.json
|
||||
|
||||
Reference in New Issue
Block a user