Skip to content

Commit d475904

Browse files
committed
linting T_T
1 parent ef3b0c7 commit d475904

23 files changed

Lines changed: 53 additions & 70 deletions

File tree

‎.github/workflows/backend-ci.yml‎

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,74 @@
1-
name: Backend Tests
1+
name: Backend CI
22

33
on:
44
push:
5+
branches: [ main, dev ]
6+
paths:
7+
- "backend/**"
8+
- ".github/workflows/backend-ci.yml"
59
pull_request:
10+
branches: [ main, dev ]
11+
paths:
12+
- "backend/**"
13+
- ".github/workflows/backend-ci.yml"
614

715
permissions:
816
contents: read
917

1018
jobs:
1119
test:
1220
runs-on: ubuntu-latest
21+
22+
env:
23+
DJANGO_SETTINGS_MODULE: config.settings.local
24+
POSTGRES_DB: fashio_test_db
25+
POSTGRES_USER: fashio_test_user
26+
POSTGRES_PASSWORD: fashio_test_password
27+
POSTGRES_HOST: localhost
28+
POSTGRES_PORT: 5432
29+
JWT_SECRET: test-jwt-secret-key-for-ci-pipeline
30+
31+
defaults:
32+
run:
33+
working-directory: backend
1334

1435
services:
1536
postgres:
1637
image: postgres:16-alpine
1738
env:
18-
POSTGRES_USER: ${{ vars.POSTGRES_USER || 'fashio_admin' }}
19-
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD || 'local_test_password' }}
20-
POSTGRES_DB: ${{ vars.POSTGRES_DB || 'fashio_db' }}
39+
POSTGRES_DB: fashio_test_db
40+
POSTGRES_USER: fashio_test_user
41+
POSTGRES_PASSWORD: fashio_test_password
2142
ports:
2243
- 5432:5432
2344
options: >-
2445
--health-cmd pg_isready
25-
--health-interval 10s
46+
--health-interval 5s
2647
--health-timeout 5s
2748
--health-retries 5
2849
2950
steps:
3051
- name: Checkout source code
3152
uses: actions/checkout@v4
3253

33-
- name: Install uv and set up python
54+
- name: Install uv and enable caching
3455
uses: astral-sh/setup-uv@v5
3556
with:
3657
version: "latest"
3758
enable-cache: true
3859
cache-dependency-lock-file: "backend/uv.lock"
3960

40-
- name: Install dependencies
41-
working-directory: backend
61+
- name: Ensure Python 3.12 is installed
62+
run: uv python install 3.12
63+
64+
- name: Install project dependencies
4265
run: uv sync --frozen
4366

44-
- name: Run flake8
45-
working-directory: backend
46-
run: |
47-
uv run flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics
48-
uv run flake8 . --exclude=.venv --count --exit-zero --max-complexity=10 --max-line-length=119 --statistics
67+
- name: Lint code with Ruff
68+
run: uv run ruff check .
4969

50-
- name: Run black check
51-
working-directory: backend
52-
run: uvx black --check --verbose .
70+
- name: Check code formatting with Ruff
71+
run: uv run ruff format --check .
5372

54-
- name: Run pytest
55-
working-directory: backend
73+
- name: Run Pytest suite
5674
run: uv run pytest
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from django.contrib import admin
2-
31
# Register your models here.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from django.db import models
2-
31
# Create your models here.

‎backend/apps/authentication/serializers.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from rest_framework import serializers
21
from django.contrib.auth.models import User
2+
from rest_framework import serializers
33

44

55
class RegisterSerializer(serializers.ModelSerializer):
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from django.test import TestCase
2-
31
# Create your tests here.

‎backend/apps/authentication/urls.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.urls import path
2+
23
from . import views
34

45
urlpatterns = [

‎backend/apps/authentication/views.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from rest_framework import generics
21
from django.contrib.auth.models import User
2+
from rest_framework import generics
3+
34
from .serializers import RegisterSerializer
45

56

‎backend/apps/catalog/admin.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from django.contrib import admin
2-
31
# Register your models here.

‎backend/apps/catalog/models.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from django.db import models
2-
31
# Create your models here.

‎backend/apps/catalog/tests.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from django.test import TestCase
2-
31
# Create your tests here.

0 commit comments

Comments
 (0)