-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
46 lines (38 loc) · 1.29 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
default:
@just --list
# build tinyurl binary
build:
go build -o tinyurl ./cmd/tinyurl
# update go packages
update:
@cd ./cmd/tinyurl && go get -u
# set up the dev environment with docker-compose
dev cmd *flags:
#!/usr/bin/env bash
set -euxo pipefail
if [ {{ cmd }} = 'down' ]; then
docker compose -f ./deployments/docker-compose.yml down --remove-orphans
docker compose -f ./deployments/docker-compose.yml rm
elif [ {{ cmd }} = 'up' ]; then
docker compose -f ./deployments/docker-compose.yml up --wait -d {{ flags }}
else
docker compose -f ./deployments/docker-compose.yml {{ cmd }} {{ flags }}
fi
# run tests in the dev environment
test: (dev "up")
just seed
go test -v -race -shuffle=on ./... -covermode=atomic -coverprofile=coverage.out
seed: (dev "up")
atlas migrate diff --env local
atlas migrate apply --env local
go run ./cmd/tinyurl/main.go seed
# connect into the dev environment database
database: (dev "up") (dev "exec" "database psql postgresql://tinyurl:secret@localhost/tinyurl")
# run golangci-lint linting
[group("lint")]
go-lint *flags:
golangci-lint run -c .golangci.yml {{ flags }}
# run atlas linting over migrations
[group("lint")]
atlas-lint *flags:
atlas migrate lint --env local --git-base origin/main