-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (61 loc) · 1.75 KB
/
Copy pathcode-backend.yml
File metadata and controls
63 lines (61 loc) · 1.75 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
name: "Code - Backend"
on:
pull_request:
types:
- synchronize
- opened
paths:
- 'backend/**'
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
strategy:
matrix:
python-version: [ "3.12" ]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout the repository
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install All Dependencies
run: uv sync --frozen --all-groups
- name: Run Ruff
run: uv run ruff check --output-format=github
- name: Run tests
run: uv run pytest -q
- name: Run Migrations
run: |
eval $(grep -m 4 'export' README.md | tail -n 4)
export ENV=test
export SQLALCHEMY_DATABASE_URI=postgresql://postgres:postgres@localhost:5432/postgres
uv run alembic upgrade head
- name: Export requirements for vulnerability scan
run: >-
uv export --format requirements-txt --all-groups --no-hashes
--no-emit-project --frozen -o requirements-audit.txt
- name: Check for vulnerabilities
uses: pypa/gh-action-pip-audit@v1.1.0
with:
inputs: backend/requirements-audit.txt