Merge branch 'dev' of https://github.com/MaibornWolff/SecObserve into… #348
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: Check backend | |
on: [push, pull_request] | |
permissions: read-all | |
env: | |
POETRY_NO_INTERACTION: 1 | |
jobs: | |
code_quality: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python | |
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
working-directory: ./backend | |
run: | | |
python -m pip install --upgrade -r poetry_requirements.txt | |
python -m pip install --upgrade import-linter | |
python -m poetry install --extras "code_quality dev" --no-root | |
- name: Flake8 | |
working-directory: ./backend | |
run: | | |
poetry run flake8 . --count --show-source --statistics | |
- name: Black | |
working-directory: ./backend | |
run: | | |
poetry run black . --check | |
- name: isort | |
working-directory: ./backend | |
run: | | |
poetry run isort . -c | |
- name: MyPy | |
working-directory: ./backend | |
run: | | |
./bin/run_mypy.sh | |
- name: PyLint | |
working-directory: ./backend | |
run: | | |
./bin/run_pylint.sh | |
- name: Import linter | |
working-directory: ./backend | |
run: | | |
lint-imports --no-cache | |
unittests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Unittests | |
run: | | |
docker build -f docker/backend/unittests/django/Dockerfile -t secobserve_backend_unittests:latest . | |
docker run --rm \ | |
--volume ./backend:/home \ | |
--env-file docker/backend/unittests/envs/django \ | |
--env-file docker/backend/unittests/envs/sqlite \ | |
secobserve_backend_unittests:latest | |
- name: "Upload coverage report" | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: coverage-report | |
path: backend/coverage.xml | |
retention-days: 1 | |
check_code_sonarqube_backend: | |
if: github.repository == 'MaibornWolff/SecObserve' | |
needs: [unittests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Download a single artifact | |
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
with: | |
name: coverage-report | |
- name: Run SonarQube scan for backend | |
uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5.2.0 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
projectBaseDir: backend |