Add CI
This commit is contained in:
parent
bfcf26e425
commit
8cd69fd312
3 changed files with 128 additions and 2 deletions
82
.github/workflows/ci.yml
vendored
Normal file
82
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-python:
|
||||||
|
name: Lint Python
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v4
|
||||||
|
with:
|
||||||
|
version: "latest"
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
run: uv python install 3.12
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync --dev
|
||||||
|
|
||||||
|
- name: Run ruff check
|
||||||
|
run: uv run ruff check .
|
||||||
|
|
||||||
|
- name: Run ruff format check
|
||||||
|
run: uv run ruff format --check .
|
||||||
|
|
||||||
|
lint-frontend:
|
||||||
|
name: Lint Frontend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: frontend
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
cache: "npm"
|
||||||
|
cache-dependency-path: frontend/package-lock.json
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Run Prettier check
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
|
- name: Run TypeScript check
|
||||||
|
run: npm run typecheck
|
||||||
|
|
||||||
|
build-frontend:
|
||||||
|
name: Build Frontend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint-frontend]
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: frontend
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
cache: "npm"
|
||||||
|
cache-dependency-path: frontend/package-lock.json
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash
|
curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash
|
||||||
task install
|
task prepare
|
||||||
```
|
```
|
||||||
|
|
||||||
## Area
|
## Area
|
||||||
|
|
|
||||||
46
Taskfile.yml
46
Taskfile.yml
|
|
@ -51,7 +51,51 @@ tasks:
|
||||||
- uv run fastapi run server/main.py --port 8001
|
- uv run fastapi run server/main.py --port 8001
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
desc: Lint and format Python code
|
desc: Lint all code (Python and TypeScript)
|
||||||
|
cmds:
|
||||||
|
- task: lint:python
|
||||||
|
- task: lint:frontend
|
||||||
|
|
||||||
|
lint:python:
|
||||||
|
desc: Lint Python code with ruff
|
||||||
|
cmds:
|
||||||
|
- uv run ruff check .
|
||||||
|
|
||||||
|
lint:frontend:
|
||||||
|
desc: Lint frontend TypeScript code
|
||||||
|
dir: frontend
|
||||||
|
cmds:
|
||||||
|
- npm run lint
|
||||||
|
- npm run format:check
|
||||||
|
|
||||||
|
format:
|
||||||
|
desc: Format all code (Python and TypeScript)
|
||||||
|
cmds:
|
||||||
|
- task: format:python
|
||||||
|
- task: format:frontend
|
||||||
|
|
||||||
|
format:python:
|
||||||
|
desc: Format Python code with ruff
|
||||||
cmds:
|
cmds:
|
||||||
- uv run ruff check --fix .
|
- uv run ruff check --fix .
|
||||||
- uv run ruff format .
|
- uv run ruff format .
|
||||||
|
|
||||||
|
format:frontend:
|
||||||
|
desc: Format frontend TypeScript code
|
||||||
|
dir: frontend
|
||||||
|
cmds:
|
||||||
|
- npm run lint:fix
|
||||||
|
- npm run format
|
||||||
|
|
||||||
|
check:
|
||||||
|
desc: Run all checks (lint, typecheck, build)
|
||||||
|
cmds:
|
||||||
|
- task: lint
|
||||||
|
- task: typecheck
|
||||||
|
- task: build
|
||||||
|
|
||||||
|
typecheck:
|
||||||
|
desc: Type check frontend TypeScript code
|
||||||
|
dir: frontend
|
||||||
|
cmds:
|
||||||
|
- npm run typecheck
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue