Files
software-station/Taskfile.yml
Sudo-Ivan 8204dbf811
Some checks failed
renovate / renovate (push) Has been cancelled
CI / build (push) Has been cancelled
Update Taskfile.yml
2025-12-28 00:56:49 -06:00

161 lines
3.4 KiB
YAML

version: '3'
vars:
BINARY_NAME: software-station
FRONTEND_DIR: frontend
BUILD_DIR: build
VERIFIER_DIR: software-verifier
WASM_OUT: frontend/static/verifier
VERSION:
sh: grep '"version":' frontend/package.json | cut -d'"' -f4
BUILD_DATE:
sh: date -u +'%Y-%m-%dT%H:%M:%SZ'
VCS_REF:
sh: git rev-parse --short HEAD 2>/dev/null || echo "unknown"
tasks:
default:
desc: Build everything
cmds:
- task: all
all:
desc: Build everything
deps: [build-go]
dev:
desc: Start development environment (parallel)
deps: [build-wasm]
cmds:
- task: dev-frontend
- task: dev-backend
parallel: true
dev-frontend:
internal: true
dir: "{{.FRONTEND_DIR}}"
cmds:
- pnpm dev
dev-backend:
internal: true
cmds:
- go run main.go
preview:
desc: Preview the production build
dir: "{{.FRONTEND_DIR}}"
cmds:
- pnpm preview
build-wasm:
desc: Build WASM verifier
sources:
- "{{.VERIFIER_DIR}}/**/*.go"
generates:
- "{{.WASM_OUT}}/verifier.wasm"
- "{{.WASM_OUT}}/wasm_exec.js"
cmds:
- mkdir -p {{.WASM_OUT}}
- cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" {{.WASM_OUT}}/wasm_exec.js
- cd {{.VERIFIER_DIR}} && GOOS=js GOARCH=wasm go build -o ../{{.WASM_OUT}}/verifier.wasm .
- go run scripts/sri-gen/main.go frontend/src/lib/verifier.ts
silent: true
build-frontend:
desc: Build Svelte frontend
deps: [build-wasm]
sources:
- "{{.FRONTEND_DIR}}/**/*"
- exclude: "{{.FRONTEND_DIR}}/node_modules/**/*"
- exclude: "{{.FRONTEND_DIR}}/build/**/*"
generates:
- "{{.FRONTEND_DIR}}/build/**/*"
cmds:
- cd {{.FRONTEND_DIR}} && pnpm install && pnpm build
- go run scripts/sri-gen/main.go
build-go:
desc: Build main Go application
deps: [build-frontend]
sources:
- "**/*.go"
- exclude: "{{.VERIFIER_DIR}}/**/*"
- exclude: "scripts/**/*"
generates:
- "{{.BINARY_NAME}}"
cmds:
- go build -o {{.BINARY_NAME}} main.go
release:
desc: Build release binary
deps: [build-frontend]
cmds:
- CGO_ENABLED=0 go build -ldflags="-s -w" -o {{.BINARY_NAME}} main.go
run:
desc: Run the application
deps: [all]
cmds:
- ./{{.BINARY_NAME}}
format:
desc: Format code
cmds:
- go fmt ./...
- cd {{.FRONTEND_DIR}} && pnpm run format
lint:
desc: Lint code
cmds:
- go vet ./...
- cd {{.FRONTEND_DIR}} && pnpm run lint
scan:
desc: Security scan
cmds:
- gosec ./...
check:
desc: Type check frontend
cmds:
- cd {{.FRONTEND_DIR}} && pnpm run check
tidy:
desc: Run format, lint, and check
cmds:
- task: format
- task: lint
- task: check
test:
desc: Run tests
deps: [test-wasm]
cmds:
- go test -v -coverpkg=./... ./...
test-wasm:
desc: Run WASM tests
dir: "{{.VERIFIER_DIR}}"
cmds:
- go test -v ./...
clean:
desc: Clean build artifacts
cmds:
- rm -rf {{.FRONTEND_DIR}}/build
- rm -rf {{.WASM_OUT}}
- rm -f {{.BINARY_NAME}}
- rm -f coverage.out
docker-build:
desc: Build Docker image
cmds:
- |
docker build \
--build-arg VERSION={{.VERSION}} \
--build-arg BUILD_DATE={{.BUILD_DATE}} \
--build-arg VCS_REF={{.VCS_REF}} \
-t {{.BINARY_NAME}}:latest \
-t {{.BINARY_NAME}}:{{.VERSION}} .