aboutsummaryrefslogtreecommitdiff
path: root/justfile
blob: e60d3ea07ee975d335e005df1ad435d1bfee5c3d (plain)
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
TEMPDIR := `mktemp -d`
BUILDDIR := "_build"
alias dr := debug-run
alias dt := debug-test


docker:
    docker build -t go-git-server .

docker-run:
    docker run -it --rm -p 8080:8080 --volume $(pwd)/tokens.csv:/opt/app/etc/tokens.csv go-git-server

clean:
    rm -r {{ BUILDDIR }}

builddir:
    mkdir -p {{ BUILDDIR }}/{bin,etc}

build: test builddir
    cp policy.csv auth_model.ini gitserver.yaml {{ BUILDDIR }}/etc/ 
    CGO_ENABLED=0 go build -a -ldflags '-s' -o {{ BUILDDIR }}//bin/go-git-server cmd/main.go

run:
    go run cmd/main.go -s {{justfile_directory()}}/gitserver.yaml -r $(mktemp -d)

test:
    golangci-lint run
    go test -v -coverprofile={{ TEMPDIR }}/testcover.out ./...
    go tool cover -func={{ TEMPDIR }}/testcover.out

debug-run:
    dlv debug cmd/main.go -- -s {{justfile_directory()}}/gitserver.yaml -r $(mktemp -d) 

debug-test pkg:
    dlv test {{pkg}} -- -test.v