-
Notifications
You must be signed in to change notification settings - Fork 837
82 lines (81 loc) · 2.78 KB
/
Copy pathbackend-coverage.yaml
File metadata and controls
82 lines (81 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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