forked from artefactual-labs/enduro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
176 lines (143 loc) · 6.82 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
include .bingo/Variables.mk
SHELL=/bin/bash
BUILD_TIME=$(shell date -u +%Y-%m-%dT%T%z)
GIT_COMMIT=$(shell git rev-parse --short HEAD)
LD_FLAGS= '-X "main.buildTime=$(BUILD_TIME)" -X main.gitCommit=$(GIT_COMMIT)'
GO_FLAGS= -ldflags=$(LD_FLAGS)
define NEWLINE
endef
IGNORED_PACKAGES := \
github.com/penwern/enduro/hack/gencols \
github.com/penwern/enduro/hack/landfill/gencols \
github.com/penwern/enduro/internal/amclient/fake \
github.com/penwern/enduro/internal/api/design \
github.com/penwern/enduro/internal/api/gen/batch \
github.com/penwern/enduro/internal/api/gen/eark \
github.com/penwern/enduro/internal/api/gen/collection \
github.com/penwern/enduro/internal/api/gen/collection/views \
github.com/penwern/enduro/internal/api/gen/http/batch/client \
github.com/penwern/enduro/internal/api/gen/http/batch/server \
github.com/penwern/enduro/internal/api/gen/http/eark/client \
github.com/penwern/enduro/internal/api/gen/http/eark/server \
github.com/penwern/enduro/internal/api/gen/http/cli/enduro \
github.com/penwern/enduro/internal/api/gen/http/collection/client \
github.com/penwern/enduro/internal/api/gen/http/collection/server \
github.com/penwern/enduro/internal/api/gen/http/pipeline/client \
github.com/penwern/enduro/internal/api/gen/http/pipeline/server \
github.com/penwern/enduro/internal/api/gen/http/swagger/client \
github.com/penwern/enduro/internal/api/gen/http/swagger/server \
github.com/penwern/enduro/internal/api/gen/pipeline \
github.com/penwern/enduro/internal/api/gen/pipeline/views \
github.com/penwern/enduro/internal/api/gen/swagger \
github.com/penwern/enduro/internal/batch/fake \
github.com/penwern/enduro/internal/eark/fake \
github.com/penwern/enduro/internal/collection/fake \
github.com/penwern/enduro/internal/pipeline/fake \
github.com/penwern/enduro/internal/testutil \
github.com/penwern/enduro/internal/watcher/fake
PACKAGES := $(shell go list ./...)
TEST_PACKAGES := $(filter-out $(IGNORED_PACKAGES),$(PACKAGES))
export PATH:=$(GOBIN):$(PATH)
.DEFAULT_GOAL := run
$(GOBIN)/bingo:
$(GO) install github.com/bwplotka/bingo@latest
bingo: $(GOBIN)/bingo
tools: bingo
bingo get
bingo list
run: enduro-dev
./build/enduro
enduro-dev:
mkdir -p ./build
$(GO) build -trimpath -o build/enduro $(GO_FLAGS) -v
test:
@$(GOTESTSUM) $(TEST_PACKAGES)
test-race:
@$(GOTESTSUM) $(TEST_PACKAGES) -- -race
ignored:
$(foreach PACKAGE,$(IGNORED_PACKAGES),@echo $(PACKAGE)$(NEWLINE))
lint:
$(GOLANGCI_LINT) run -v --timeout=5m --fix
goagen:
$(GOA) gengithub.com/penwern/enduro/internal/api/design -o internal/api
clean:
rm -rf ./build ./dist
release-test-config:
$(GORELEASER) --snapshot --skip-publish --rm-dist
release-test:
$(GORELEASER) --skip-publish
PROJECT := enduro
UNAME_OS := $(shell uname -s)
UNAME_ARCH := $(shell uname -m)
CACHE_BASE := $(HOME)/.cache/$(PROJECT)
CACHE := $(CACHE_BASE)/$(UNAME_OS)/$(UNAME_ARCH)
CACHE_BIN := $(CACHE)/bin
export PATH := $(abspath $(CACHE_BIN)):$(PATH)
CACHE_VERSIONS := $(CACHE)/versions
HUGO_VERSION := 0.90.0
HUGO := $(CACHE_VERSIONS)/hugo/$(HUGO_VERSION)
$(HUGO):
@rm -f $(CACHE_BIN)/hugo
@mkdir -p $(CACHE_BIN)
curl -sSL "https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_extended_$(HUGO_VERSION)_Linux-64bit.tar.gz" | tar xzf - -C "$(CACHE_BIN)"
chmod +x "$(CACHE_BIN)/hugo"
@rm -rf $(dir $(HUGO))
@mkdir -p $(dir $(HUGO))
@touch $(HUGO)
website: $(HUGO)
hugo serve --source=website/
ui:
yarn --cwd ui install
yarn --cwd ui build
ui-dev:
yarn --cwd ui serve
ui-client:
@rm -rf $(CURDIR)/ui/src/client
@docker container run --rm --user $(shell id -u):$(shell id -g) --volume $(CURDIR):/local openapitools/openapi-generator-cli:v4.2.3 \
generate \
--input-spec /local/internal/api/gen/http/openapi.json \
--generator-name typescript-fetch \
--output /local/ui/src/openapi-generator/ \
--skip-validate-spec \
-p "generateAliasAsModel=true" \
-p "typescriptThreePlus=true" \
-p "withInterfaces=true"
@echo "@@@@ Please, review all warnings generated by openapi-generator-cli above!"
@echo "@@@@ We're using \`--skip-validate-spec\` to deal with Goa spec generation issues."
cadence-flush:
docker compose exec mysql mysql -hlocalhost -uroot -proot123 -e "DROP DATABASE IF EXISTS cadence;"
docker compose exec mysql mysql -hlocalhost -uroot -proot123 -e "DROP DATABASE IF EXISTS cadence_visibility;"
docker compose exec mysql mysql -hlocalhost -uroot -proot123 -e "CREATE DATABASE IF NOT EXISTS cadence;"
docker compose exec mysql mysql -hlocalhost -uroot -proot123 -e "CREATE DATABASE IF NOT EXISTS cadence_visibility;"
docker compose run --rm cadence /seed.sh
docker compose restart cadence
$(MAKE) cadence-domain
cadence-seed:
docker compose run --rm cadence /seed.sh
cadence-domain:
docker run -it --network=host --rm ubercadence/cli:master --address=127.0.0.1:7400 --domain=enduro domain register --global_domain=false --active_cluster=active
db:
docker compose exec --user=root mysql mysql -hlocalhost -uroot -proot123
flush:
docker compose exec --user=root mysql mysql -hlocalhost -uroot -proot123 -e "drop database enduro"
docker compose exec --user=root mysql mysql -hlocalhost -uroot -proot123 -e "create database enduro"
gen-mock:
$(MOCKGEN) -destination=./internal/batch/fake/mock_batch.go -package=fakegithub.com/penwern/enduro/internal/batch Service
$(MOCKGEN) -destination=./internal/eark/fake/mock_eark.go -package=fakegithub.com/penwern/enduro/internal/eark Service
$(MOCKGEN) -destination=./internal/collection/fake/mock_collection.go -package=fakegithub.com/penwern/enduro/internal/collection Service
$(MOCKGEN) -destination=./internal/pipeline/fake/mock_pipeline.go -package=fakegithub.com/penwern/enduro/internal/pipeline Service
$(MOCKGEN) -destination=./internal/watcher/fake/mock_watcher.go -package=fakegithub.com/penwern/enduro/internal/watcher Service
$(MOCKGEN) -destination=./internal/amclient/fake/mock_ingest.go -package=fakegithub.com/penwern/enduro/internal/amclient IngestService
$(MOCKGEN) -destination=./internal/amclient/fake/mock_processing_config.go -package=fakegithub.com/penwern/enduro/internal/amclient ProcessingConfigService
$(MOCKGEN) -destination=./internal/amclient/fake/mock_transfer.go -package=fakegithub.com/penwern/enduro/internal/amclient TransferService
$(MOCKGEN) -destination=./internal/amclient/fake/mock_v2_jobs.go -package=fakegithub.com/penwern/enduro/internal/amclient JobsService
$(MOCKGEN) -destination=./internal/amclient/fake/mock_v2_package.go -package=fakegithub.com/penwern/enduro/internal/amclient PackageService
$(MOCKGEN) -destination=./internal/amclient/fake/mock_v2_task.go -package=fakegithub.com/penwern/enduro/internal/amclient TaskService
.PHONY: *
# Penwern Addition. Removes generated files and folders from previously run eark-aip-generator workflows
# Doesn't remove sips from sip directory
clean-eark:
rm -f sips/*.json
rm -rf am_transfers/
rm -rf eark_aips/
rm -rf logs/