diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml new file mode 100644 index 0000000..9ca4f3f --- /dev/null +++ b/.github/workflows/ci-check.yml @@ -0,0 +1,50 @@ +name: CI Lint/Format/Test Check + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + check-python: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install uv + uses: astral-sh/setup-uv@v3 + + - name: Run Python checks + run: uv run hatch run all-check + + check-ui: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + + - name: Enable Corepack + run: corepack enable + + - name: Activate pnpm version + working-directory: ui + run: corepack prepare --activate + + + - name: Run UI checks + run: pnpm run all-check + working-directory: ui \ No newline at end of file diff --git a/.gitignore b/.gitignore index d532694..766dc54 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __pycache__ uv.lock pnpm-lock.yaml +*.db diff --git a/.gitignore.jinja b/.gitignore.jinja index 033df5f..4fb35f4 100644 --- a/.gitignore.jinja +++ b/.gitignore.jinja @@ -1,2 +1,3 @@ .venv __pycache__ +workflows.db diff --git a/.gitignore.template b/.gitignore.template deleted file mode 100644 index 033df5f..0000000 --- a/.gitignore.template +++ /dev/null @@ -1,2 +0,0 @@ -.venv -__pycache__ diff --git a/copier.yaml b/copier.yaml new file mode 100644 index 0000000..58d93e7 --- /dev/null +++ b/copier.yaml @@ -0,0 +1,4 @@ +_exclude: + - ".git" + - ".github" + - "copier.yaml" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 092469e..8077334 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,22 @@ build-backend = "hatchling.build" [dependency-groups] dev = [ "ruff>=0.13.0", + "ty>=0.0.1a16", + "pytest>=8.4.1", + "hatch>=1.14.1", ] + +[tool.hatch.envs.default.scripts] +"format" = "ruff format ." +"format-check" = "ruff format --check ." +"lint" = "ruff check --fix ." +"lint-check" = ["ruff check ."] +typecheck = "ty check src" +test = "pytest" +"all-check" = ["format-check", "lint-check", "test"] +"all-fix" = ["format", "lint", "test"] + [tool.llamadeploy.ui] directory = "./ui" @@ -27,3 +41,4 @@ env-files = [".env"] [tool.llamadeploy.workflows] default = "app.workflow:workflow" + diff --git a/src/app/workflow.py b/src/app/workflow.py index c76cc2f..afa13b8 100644 --- a/src/app/workflow.py +++ b/src/app/workflow.py @@ -1,7 +1,7 @@ import asyncio from workflows import Context, Workflow, step -from workflows.events import Event, StartEvent, StopEvent +from workflows.events import StartEvent, StopEvent import logging logger = logging.getLogger(__name__) diff --git a/tests/test_placeholder.py b/tests/test_placeholder.py new file mode 100644 index 0000000..201975f --- /dev/null +++ b/tests/test_placeholder.py @@ -0,0 +1,2 @@ +def test_placeholder(): + pass diff --git a/ui/package.json b/ui/package.json index bf4a4c0..4d489c6 100644 --- a/ui/package.json +++ b/ui/package.json @@ -5,8 +5,13 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc -b && vite build", - "preview": "vite preview" + "build": "tsc && vite build", + "preview": "vite preview", + "lint": "tsc --noEmit", + "format": "prettier --write src", + "format-check": "prettier --check src", + "all-check": "pnpm i && pnpm run lint && pnpm run format-check && pnpm run build", + "all-fix": "pnpm i && pnpm run lint && pnpm run format && pnpm run build" }, "dependencies": { "canvas-confetti": "^1.9.3", @@ -15,14 +20,15 @@ "react-router-dom": "^7.8.0" }, "devDependencies": { + "@llamaindex/ui": "^1.0.2", "@tailwindcss/postcss": "^4", "@types/canvas-confetti": "^1.9.0", - "@llamaindex/ui": "^1.0.2", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", "@vitejs/plugin-react": "^4.3.4", "eslint": "^9", + "prettier": "^3.6.2", "tailwindcss": "^4", "typescript": "^5", "vite": "^5.4.8" diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx index 050bb71..cf8afa5 100644 --- a/ui/src/pages/Home.tsx +++ b/ui/src/pages/Home.tsx @@ -75,7 +75,7 @@ function HandlerOuput({ handlerId }: { handlerId: string }) { const taskData = useWorkflowTask(handlerId); const result = taskData.events.find((event) => - event.type.match(/PongEvent$/) + event.type.match(/PongEvent$/), ) as { type: string; data: { message: string } } | undefined; return {result ? result.data.message : "Running... "};