2022-08-30 02:30:36 +00:00
|
|
|
version: "3"
|
|
|
|
|
2022-09-28 04:26:44 +00:00
|
|
|
env:
|
|
|
|
HBOX_STORAGE_SQLITE_URL: .data/homebox.db?_fk=1
|
2022-10-17 02:50:44 +00:00
|
|
|
UNSAFE_DISABLE_PASSWORD_PROJECTION: "yes_i_am_sure"
|
2022-08-30 02:30:36 +00:00
|
|
|
tasks:
|
2022-10-15 20:56:58 +00:00
|
|
|
setup:
|
2022-10-30 02:15:35 +00:00
|
|
|
desc: Install development dependencies
|
2022-10-15 20:56:58 +00:00
|
|
|
cmds:
|
2022-10-17 02:50:44 +00:00
|
|
|
- go install github.com/swaggo/swag/cmd/swag@latest
|
|
|
|
- cd backend && go mod tidy
|
|
|
|
- cd frontend && pnpm install --shamefully-hoist
|
2022-10-30 02:15:35 +00:00
|
|
|
|
2022-09-12 22:47:27 +00:00
|
|
|
generate:
|
2022-09-24 19:33:38 +00:00
|
|
|
desc: |
|
|
|
|
Generates collateral files from the backend project
|
|
|
|
including swagger docs and typescripts type for the frontend
|
2022-09-28 04:26:44 +00:00
|
|
|
deps:
|
|
|
|
- db:generate
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-10-25 02:24:18 +00:00
|
|
|
- cd backend/app/api/static && swag fmt --dir=../
|
|
|
|
- cd backend/app/api/static && swag init --dir=../,../../../internal,../../../pkgs
|
2022-09-12 22:47:27 +00:00
|
|
|
- |
|
|
|
|
npx swagger-typescript-api \
|
|
|
|
--no-client \
|
|
|
|
--modular \
|
2022-10-25 02:24:18 +00:00
|
|
|
--path ./backend/app/api/static/docs/swagger.json \
|
2022-09-12 22:47:27 +00:00
|
|
|
--output ./frontend/lib/api/types
|
2023-01-07 07:15:59 +00:00
|
|
|
- go run ./scripts/process-types/*.go ./frontend/lib/api/types/data-contracts.ts
|
2022-09-24 19:33:38 +00:00
|
|
|
sources:
|
|
|
|
- "./backend/app/api/**/*"
|
2022-10-30 04:05:38 +00:00
|
|
|
- "./backend/internal/data/**"
|
2022-10-09 13:03:24 +00:00
|
|
|
- "./backend/internal/services/**/*"
|
2022-09-24 19:33:38 +00:00
|
|
|
- "./scripts/process-types.py"
|
|
|
|
generates:
|
|
|
|
- "./frontend/lib/api/types/data-contracts.ts"
|
2022-10-30 04:05:38 +00:00
|
|
|
- "./backend/internal/data/ent/schema"
|
2022-10-25 02:24:18 +00:00
|
|
|
- "./backend/app/api/static/docs/swagger.json"
|
|
|
|
- "./backend/app/api/static/docs/swagger.yaml"
|
2022-09-24 19:33:38 +00:00
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:run:
|
2022-09-24 19:33:38 +00:00
|
|
|
desc: Starts the backend api server (depends on generate task)
|
|
|
|
deps:
|
|
|
|
- generate
|
2022-09-12 22:47:27 +00:00
|
|
|
cmds:
|
2022-09-24 19:33:38 +00:00
|
|
|
- cd backend && go run ./app/api/ {{ .CLI_ARGS }}
|
2022-08-30 02:30:36 +00:00
|
|
|
silent: false
|
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:test:
|
|
|
|
desc: Runs all go tests using gotestsum - supports passing gotestsum args
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-10-30 02:15:35 +00:00
|
|
|
- cd backend && gotestsum {{ .CLI_ARGS }} ./...
|
2022-08-30 02:30:36 +00:00
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:coverage:
|
|
|
|
desc: Runs all go tests with -race flag and generates a coverage report
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-10-30 02:15:35 +00:00
|
|
|
- cd backend && go test -race -coverprofile=coverage.out -covermode=atomic ./app/... ./internal/... ./pkgs/... -v -cover
|
2022-08-30 02:30:36 +00:00
|
|
|
silent: true
|
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:tidy:
|
|
|
|
desc: Runs go mod tidy on the backend
|
2022-09-12 22:47:27 +00:00
|
|
|
cmds:
|
2022-10-30 02:15:35 +00:00
|
|
|
- cd backend && go mod tidy
|
2022-09-12 22:47:27 +00:00
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:lint:
|
|
|
|
desc: Runs golangci-lint
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-10-30 02:15:35 +00:00
|
|
|
- cd backend && golangci-lint run ./...
|
2022-08-30 02:30:36 +00:00
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:all:
|
|
|
|
desc: Runs all go test and lint related tasks
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-10-30 02:15:35 +00:00
|
|
|
- task: go:tidy
|
|
|
|
- task: go:lint
|
|
|
|
- task: go:test
|
2022-08-30 02:30:36 +00:00
|
|
|
|
2022-10-30 02:15:35 +00:00
|
|
|
go:build:
|
|
|
|
desc: Builds the backend binary
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-10-30 02:15:35 +00:00
|
|
|
- cd backend && go build -o ../build/backend ./app/api
|
2022-09-28 04:26:44 +00:00
|
|
|
|
|
|
|
db:generate:
|
|
|
|
desc: Run Entgo.io Code Generation
|
|
|
|
cmds:
|
|
|
|
- |
|
2022-10-30 04:05:38 +00:00
|
|
|
cd backend/internal/ && go generate ./... \
|
|
|
|
--template=./data/ent/schema/templates/has_id.tmpl
|
2022-09-28 04:26:44 +00:00
|
|
|
sources:
|
2022-10-30 04:05:38 +00:00
|
|
|
- "./backend/internal/data/ent/schema/**/*"
|
2022-09-28 04:26:44 +00:00
|
|
|
generates:
|
2022-10-30 04:05:38 +00:00
|
|
|
- "./backend/internal/ent/"
|
2022-09-28 04:26:44 +00:00
|
|
|
|
|
|
|
db:migration:
|
|
|
|
desc: Runs the database diff engine to generate a SQL migration files
|
|
|
|
deps:
|
|
|
|
- db:generate
|
|
|
|
cmds:
|
2022-10-30 04:05:38 +00:00
|
|
|
- cd backend && go run app/tools/migrations/main.go {{ .CLI_ARGS }}
|
2022-10-30 02:15:35 +00:00
|
|
|
|
|
|
|
ui:watch:
|
|
|
|
desc: Starts the vitest test runner in watch mode
|
|
|
|
cmds:
|
2022-11-01 22:16:22 +00:00
|
|
|
- cd frontend && pnpm run test:watch
|
2022-10-30 02:15:35 +00:00
|
|
|
|
|
|
|
ui:dev:
|
|
|
|
desc: Run frontend development server
|
|
|
|
cmds:
|
|
|
|
- cd frontend && pnpm dev
|
|
|
|
|
|
|
|
test:ci:
|
|
|
|
desc: Runs end-to-end test on a live server (only for use in CI)
|
|
|
|
cmds:
|
|
|
|
- cd backend && go build ./app/api
|
|
|
|
- backend/api &
|
|
|
|
- sleep 5
|
|
|
|
- cd frontend && pnpm run test:ci
|
|
|
|
silent: true
|