diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9fb914e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: CI workflow + +on: + push: + branches: [main] + pull_request: + +jobs: + backend: + name: Backend(Python) + runs-on: ubuntu-latest + defaults: + run: + working-directory: backend + steps: + - name: Download code + uses: actions/checkout@v4 + + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: backend/requirements.txt + + + #update pip first and then install requirements + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install ruff mypy pytest + + + - name: Ruff(using lint) + run: ruff check . + continue-on-error: true + + - name: MyPy(using type check) + run: mypy app + continue-on-error: true + + - name: PyTest + run: pytest || true + + + + + frontend: + name: Frontend(Vue) + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + steps: + - name: Download code + uses: actions/checkout@v4 + + + - name: setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "24" + cache: pnpm + cache-dependency-path: frontend/pnpm-lock.yaml + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: run EsLint + run: | + pnpm exec eslint . || echo "::warning:: ESlint was skipped as not installed, add eslint and config to enable this check" + continue-on-error: true + + - name: TypeCheck + run: | + pnpm exec vue-tsc --noEmit || echo "::warning:: Type check was skipped as not installed, add vue-tsc and config to enable this check" + continue-on-error: true + - name: ViTest + run: | + pnpm exec vitest run --passWithNoTests || echo "::warning:: Vitest was skipped as not installed, add vitest and config to enable this check" + continue-on-error: true + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26e5fcb..78004ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,8 +30,6 @@ repos: args: ["--explicit-package-bases", "backend"] pass_filenames: false additional_dependencies: - - django-stubs - - types-dj-database-url - python-dotenv - repo: https://github.com/psf/black-pre-commit-mirror diff --git a/backend/app/api/v1/endpoints/health.py b/backend/app/api/v1/endpoints/health.py index 8515e5f..fe52283 100644 --- a/backend/app/api/v1/endpoints/health.py +++ b/backend/app/api/v1/endpoints/health.py @@ -1,4 +1,5 @@ from fastapi import APIRouter + from app.core.config import settings router = APIRouter() diff --git a/backend/app/core/config.py b/backend/app/core/config.py index bb7678a..73dfc86 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -1,6 +1,7 @@ -from typing import List + from decouple import config + class Settings: # Basic settings PROJECT_NAME: str = "FastAPI Vue SPA Boilerplate" @@ -19,7 +20,7 @@ class Settings: DATABASE_URL: str = config("DATABASE_URL", default="postgresql://user:password@localhost/dbname") # CORS - BACKEND_CORS_ORIGINS: List[str] = config( + BACKEND_CORS_ORIGINS: list[str] = config( "BACKEND_CORS_ORIGINS", default="http://localhost:3000,http://localhost:5173", cast=lambda v: [i.strip() for i in v.split(",")] diff --git a/backend/app/main.py b/backend/app/main.py index be1b1c4..fbeac53 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -1,6 +1,5 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware -from decouple import config from app.api.v1.api import api_router from app.core.config import settings diff --git a/pyproject.toml b/pyproject.toml index b15f8ba..edad99d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ combine-as-imports = true [tool.mypy] python_version = "3.12" -plugins = ["mypy_django_plugin.main"] explicit_package_bases = true files = ["backend"] ignore_missing_imports = true @@ -29,5 +28,4 @@ warn_unused_ignores = true warn_redundant_casts = true -[tool.django-stubs] -django_settings_module = "backend.config.settings.dev" +