-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathjustfile
85 lines (70 loc) · 2.51 KB
/
justfile
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
alias g := generate
alias t := test
# Print the list of recipes
default:
just --list
# Build the Transiter binary and stamp it with the provided version
build VERSION="":
go build --ldflags "-X github.com/jamespfennell/transiter/internal/version.version={{VERSION}}" .
# Build the Transiter Docker image
build-docker: _require-docker
docker build . -t jamespfennell/transiter:latest
# Build the Transiter documentation
docs OUTPUT_DIR="docs/gen":
pip install -r docs/requirements.txt
mkdocs build --strict -f docs/mkdocs.yml -d ../{{OUTPUT_DIR}}
# Preview the Transiter documentation on 0.0.0.0:8001
docs-preview: docs
python3 -m http.server 8001 -d docs/gen
# Run the CI steps. Requires Docker and Postgres. Assumes the Docker image has already been built.
ci: test _run_e2e lint
# Run code autoformatters
fmt:
go fmt ./...
buf format -w
# Generate the DB and proto API code
generate:
sqlc --experimental generate
buf generate
go run docs/src/api/api_docs_gen.go
# Install all tools for working on Transiter
install-tools: install-linters
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/pseudomuto/protoc-gen-doc/cmd/[email protected]
go install github.com/kyleconroy/sqlc/cmd/[email protected]
go install github.com/bufbuild/buf/cmd/[email protected]
# Install linters used on Transiter
install-linters:
go install honnef.co/go/tools/cmd/[email protected]
# Print the versions of all tools
tool-versions:
protoc --version
protoc-gen-go --version
protoc-gen-grpc-gateway --version
protoc-gen-go-grpc --version
protoc-gen-doc --version
sqlc version
buf --version
staticcheck --version
# Run all the linters
lint: install-linters
staticcheck ./...
# Run all the unit tests
test:
go test ./...
# Run all the E2E tests (requires Docker)
test-e2e: build-docker _run_e2e
# Run all the unit and E2E tests (requires Docker)
test-all: test test-e2e
_require-docker:
@echo "Checking that Docker and Docker compose are installed. These tools are required for this recipe."
which docker
_run_e2e: _require-docker
#!/usr/bin/env sh
docker compose -f tests/endtoend/compose.yml down
docker compose -f tests/endtoend/compose.yml up --build --detach sourceserver transiter db
docker compose -f tests/endtoend/compose.yml up --build --exit-code-from testrunner testrunner || RESULT=$?
docker compose -f tests/endtoend/compose.yml down
exit ${RESULT}