-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (68 loc) · 3.3 KB
/
Copy pathMakefile
File metadata and controls
91 lines (68 loc) · 3.3 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
SHELL := bash
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SED_I := sed -i ''
else
SED_I := sed -i
endif
VERSION := $(shell git describe --tags)
COMMIT := $(shell git rev-list -1 HEAD)
BUILD_DATE := $(shell date +%FT%T%z)
SRC := $(shell find cmd config confgen env orgs policy util -name '*.go')
TEMPLATES := $(shell find policy/{templates,app} -type f)
REPOS ?= tyk tyk-analytics tyk-pump tyk-identity-broker tyk-sink portal tyk-pro
GITHUB_TOKEN ?= $(shell pass me/github)
JIRA_USER ?= alok@tyk.io
JIRA_TOKEN ?= $(shell pass Tyk/atlassian)
VARIATION ?= prod-variation
PC_TOKEN ?= $(shell pass Tyk/packagecloud)
UNSTABLE_REPOS := tyk-gateway-unstable tyk-dashboard-unstable tyk-pump-unstable tyk-mdcb-unstable portal-unstable tyk-identity-broker-unstable tyk-sync-unstable
STABLE_REPOS := tyk-gateway tyk-dashboard tyk-pump tyk-mdcb portal tyk-identity-broker
gromit: go.mod go.sum *.go $(SRC) $(TEMPLATES) update-variation
go build -v -trimpath -ldflags "-X github.com/TykTechnologies/gromit/util.version=$(VERSION) -X github.com/TykTechnologies/gromit/util.commit=$(COMMIT) -X github.com/TykTechnologies/gromit/util.buildDate=$(BUILD_DATE)"
go mod tidy
test:
go test -coverprofile cp.out ./... # dlv test ./cmd #
test-github: test
@echo Creates and closes a PR in tyklabs/git-tests
@GITHUB_TOKEN=$(GITHUB_TOKEN) go test ./policy -run TestGitFunctions
test-jira: test
@JIRA_USER=$(JIRA_USER) JIRA_TOKEN=$(JIRA_TOKEN) go test ./policy -run TestJira
update-test-cases:
@echo Updating test cases for cmd test
go test ./cmd/ -update
# Regenerate the golden render snapshot in policy/testdata/golden after an
# intended change to templates, config or rendering code. Commit the result;
# the PR diff will show the effect on every repo/branch.
update-golden:
@echo Regenerating golden render snapshot
go test ./policy -run TestGoldenRender -update
update-actions-versions: bin/update-actions-versions.sed
echo $(TEMPLATES) | xargs $(SED_I) -f $<
update-variation: policy/templates/test-square/.github/workflows/test-square.yml policy/templates/releng/.github/workflows/release.yml
$(SED_I) 's/VARIATION: .*/VARIATION: $(VARIATION)/' $^
push: dist/gromit_linux_amd64_v1/gromit
goreleaser --clean --snapshot
docker push tykio/gromit:latest
clean:
find . -name rice-box.go -o -name error.yaml | xargs rm -fv
rm -rf $(REPOS)
rm -fv gromit
unstable-cleanup: gromit
@PACKAGECLOUD_TOKEN=$(PC_TOKEN) ./gromit pkgs clean --delete $(UNSTABLE_REPOS)
stable-cleanup: gromit
@PACKAGECLOUD_TOKEN=$(PC_TOKEN) ./gromit pkgs clean $(STABLE_REPOS)
stable-cleanup-really: gromit
@PACKAGECLOUD_TOKEN=$(PC_TOKEN) ./gromit pkgs clean --delete $(STABLE_REPOS)
sync: gromit
@$(foreach r,$(REPOS), GITHUB_TOKEN=$(GITHUB_TOKEN) ./gromit policy sync $(r);)
cpr: gromit
test -n "$(TICKET)"
@GITHUB_TOKEN=$(GITHUB_TOKEN) JIRA_USER=$(JIRA_USER) JIRA_TOKEN=$(JIRA_TOKEN) ./gromit prs $@ --jira $(TICKET) $(if ifdef REVIEWERS,--reviewers $(REVIEWERS),) $(REPOS)
upr: gromit
@GITHUB_TOKEN=$(GITHUB_TOKEN) ./gromit prs $@ $(REPOS)
opr: gromit
@GITHUB_TOKEN=$(GITHUB_TOKEN) ./gromit prs $@ $(REPOS)
loc: clean
gocloc --skip-duplicated --not-match-d=\.terraform --output-type=json ~gromit ~ci | jq -r '.languages | map([.name, .code]) | transpose[] | @csv'
.PHONY: clean update-test-cases update-golden test loc cpr upr opr push