forked from sciminds/sci
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
95 lines (72 loc) · 3.15 KB
/
justfile
File metadata and controls
95 lines (72 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
commit := `git rev-parse --short HEAD 2>/dev/null || echo unknown`
ldflags := "-s -w -X github.com/sciminds/cli/internal/version.Commit=" + commit
build:
go build -ldflags="{{ldflags}}" -o sci ./cmd/sci
go build -ldflags="-s -w" -o dbtui ./cmd/dbtui
go build -ldflags="-s -w" -o markdb ./cmd/markdb
go build -ldflags="-s -w" -o zot ./cmd/zot
go build -ldflags="-s -w" -o boarddemo ./cmd/boarddemo
tidy:
go mod tidy
fmt:
gofmt -w .
goimports -w .
lint:
golangci-lint run ./internal/... ./cmd/...
vet:
go vet ./internal/... ./cmd/...
test:
go test ./... -count=1
# Integration tests needing external tools (pixi, uv, quarto, marimo, typst, node)
test-slow *ARGS:
SLOW=1 go test ./internal/proj/new -v -timeout 10m -count=1 {{ARGS}}
# Canvas + GitHub Classroom integration tests (requires CANVAS_TOKEN in .env and gh auth)
test-canvas:
SLOW=1 CANVAS_TEST_TOKEN=$CANVAS_TOKEN CANVAS_TEST_URL="https://canvas.ucsd.edu/courses/63653" GH_CLASSROOM_TEST_URL="https://classroom.github.com/classrooms/232475786-test-classroom" go test ./internal/cass/ -run Integration -v -timeout 2m -count=1
# Live R2 board tests (round-trip + privacy assertion)
test-board-live:
BOARD_LIVE=1 go test ./internal/board/ -v -count=1
# Real-Zotero-DB smoke (opt-in; reads ./zotero.sqlite or $ZOT_REAL_DB)
test-zot-real:
SLOW=1 go test ./internal/zot/local/ ./internal/zot/hygiene/ -v -count=1
test-all: test test-slow
# Run boarddemo against the in-memory fake store
boarddemo *ARGS:
go run ./cmd/boarddemo {{ARGS}}
check: tidy fmt vet lint test build
ok: check
@echo "All checks passed."
# Like `ok` but also runs proj/new integration tests (SLOW=1).
# Requires pixi, uv, quarto, marimo, typst, node on PATH.
# Does NOT run test-canvas / test-board-live / test-zot-real — those need
# credentials or live infra and stay opt-in.
ok-slow: tidy fmt vet lint test test-slow build
@echo "All checks (incl. slow) passed."
clean:
rm -f sci dbtui markdb zot boarddemo
run *ARGS:
go run ./cmd/sci {{ARGS}}
zot-spec := "/Users/esh/Documents/webapps/apis/zotero/openapi.yaml"
# Regenerate the Zotero API Go client from the OpenAPI spec.
# Downgrades 3.1 -> 3.0 on the fly (type:[T,null] -> nullable:true) because
# oapi-codegen v2 does not yet support 3.1 union types.
zot-gen:
@tmp=$(mktemp -t zotero-spec.XXXXXX.yaml); \
sd '^openapi: 3\.1\.0$' 'openapi: 3.0.3' < {{zot-spec}} \
| sd 'type: \[string, "null"\]' 'type: string\n nullable: true' \
| sd 'type: \[integer, "null"\]' 'type: integer\n nullable: true' \
| sd '^ tag:$' ' tagFilter:' \
| sd '#/components/parameters/tag"' '#/components/parameters/tagFilter"' \
> $tmp; \
(cd internal/zot/client && oapi-codegen -config config.yaml $tmp); \
rm -f $tmp
gofmt -w internal/zot/client/zotero.gen.go
# Open package documentation in the browser
docs:
@echo "Starting pkgsite at http://localhost:6060/github.com/sciminds/cli"
open "http://localhost:6060/github.com/sciminds/cli"
pkgsite -http=localhost:6060
set dotenv-load
# Deploy Cloudflare Worker (sci-auth)
worker-deploy:
cd worker && npx wrangler deploy