-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
37 lines (30 loc) · 1008 Bytes
/
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
default:
@just --list
# build gorm-sample binary
build:
go build -o gorm-sample ./cmd/cli
# update go packages
update:
@cd ./cmd/cli && 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 ./docker-compose.yml down --remove-orphans
docker compose -f ./docker-compose.yml rm
elif [ {{ cmd }} = 'up' ]; then
docker compose -f ./docker-compose.yml up --wait -d {{ flags }}
else
docker compose -f ./docker-compose.yml {{ cmd }} {{ flags }}
fi
# run tests in the dev environment
test: seed
go run ./cmd/cli/main.go
seed: (dev "up")
atlas migrate apply --env local
# connect into the dev environment database
database: (dev "up") (dev "exec" "database psql postgres://postgres:[email protected]:5432/pgsql?search_path=public&sslmode=disable")
# run golangci-lint
lint *flags:
golangci-lint run -c .golangci.yml {{ flags }}