aboutsummaryrefslogtreecommitdiff
path: root/justfile
blob: 86c4d933efff06141182ebf20d92c87b5225c987 (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
36
37
38
39
40
41
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 }}/etc
    mkdir -p {{ BUILDDIR }}/bin

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

push: docker
    docker tag go-git-server:latest public.ecr.aws/s0f9o2k5/go-git-server:latest 
    docker push public.ecr.aws/s0f9o2k5/go-git-server:latest

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) -t tokens.csv -p policy.csv -m auth_model.ini -a 
 

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