feat: improve tasks and evidences #10468
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: Backend code coverage | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| paths: | |
| - "backend/**" | |
| - ".github/workflows/backend-coverage.yaml" | |
| # Cancel older in-progress runs for the same PR or the same ref (branch) | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GITHUB_WORKFLOW: github_actions | |
| POSTGRES_VERSION: "16" | |
| UBUNTU_VERSION: "ubuntu-24.04" | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| backend-directory: ./backend | |
| DJANGO_DEBUG: "True" | |
| POSTGRES_NAME: postgres | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| DB_HOST: localhost | |
| EMAIL_HOST: localhost | |
| EMAIL_PORT: 1025 | |
| EMAIL_HOST_USER: "" | |
| EMAIL_HOST_PASSWORD: "" | |
| DEFAULT_FROM_EMAIL: "ciso-assistant@alsigo.net" | |
| CISO_ASSISTANT_SUPERUSER_EMAIL: "" | |
| CISO_ASSISTANT_URL: http://127.0.0.1:5173 | |
| services: | |
| postgres: | |
| image: ghcr.io/intuitem/ciso-assistant-community/mirror/postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres # test credential | |
| POSTGRES_DB: postgres | |
| ports: ["5432:5432"] | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python-version: ["3.14"] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install uv and set up python ${{ matrix.python-version }} | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| - name: Install backend requirements | |
| working-directory: ${{ env.backend-directory }} | |
| run: uv sync --locked | |
| - name: Run migrations | |
| working-directory: ${{ env.backend-directory }} | |
| run: uv run python manage.py migrate | |
| - name: Run coverage | |
| working-directory: ${{ env.backend-directory }} | |
| env: | |
| PG_PORT: ${{ job.services.postgres.ports[5432] }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| DATABASE_URL="postgres://postgres:postgres@localhost:${PG_PORT}/postgres" | |
| export DATABASE_URL | |
| uv run coverage run -m pytest --ignore-glob="**/test_api*" --ignore="**/venv/**" | |
| - name: Display coverage report | |
| working-directory: ${{ env.backend-directory }} | |
| env: | |
| PG_PORT: ${{ job.services.postgres.ports[5432] }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| DATABASE_URL="postgres://postgres:postgres@localhost:${PG_PORT}/postgres" | |
| export DATABASE_URL | |
| uv run coverage report |