-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
57 lines (47 loc) · 1.55 KB
/
Makefile
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
.DEFAULT_GOAL := build
.PHONY: mod
mod:
go mod download
.PHONY: test
test: mod
go test -cover ./...
.PHONY: test-ci
test-ci: mod
mkdir artifacts
go test ./... -covermode=atomic -coverprofile=artifacts/count.out
go tool cover -func=artifacts/count.out | tee artifacts/coverage.out
dist:
mkdir -p dist
.PHONY: build
build: dist mod
# build for container use: in future we will need to either use "ko" or
# "goreleaser" (or both) to create executables and images in the required
# architectures.
CGO_ENABLED=0 GOOS=linux go build -ldflags="-w" -trimpath -o dist/chinmina-bridge .
# build for local use, whatever the local platform is
CGO_ENABLED=0 go build -ldflags="-w" -trimpath -o dist/chinmina-bridge-local .
CGO_ENABLED=0 go build -o dist/oidc-local cmd/create/main.go
.PHONY: run
run: build
dist/chinmina-bridge-local
.PHONY: docker
docker: build
docker compose -f integration/docker-compose.yaml up --abort-on-container-exit
.PHONY: docker-down
docker-down:
docker compose -f integration/docker-compose.yaml down
# ensures that `go mod tidy` has been run after any dependency changes
.PHONY: ensure-deps
ensure-deps: mod
@go mod tidy
@git diff --exit-code
# use generation tool to create a JWKS key pair that can be used for local
# testing.
keygen:
go install github.com/go-jose/go-jose/v4/jose-util@latest
cd .development/keys \
&& rm -f *.json \
&& jose-util generate-key --use sig --alg RS256 --kid testing \
&& chmod +w *.json \
&& jq '. | { keys: [ . ] }' < jwk-sig-testing-pub.json > tmp.json \
&& mv tmp.json jwk-sig-testing-pub.json