forked from astronomer/astro-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (47 loc) · 2.89 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
GIT_COMMIT_SHORT=$(shell git rev-parse --short HEAD)
VERSION ?= SNAPSHOT-${GIT_COMMIT_SHORT}
LDFLAGS_VERSION=-X github.com/astronomer/astro-cli/version.CurrVersion=${VERSION}
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
CORE_OPENAPI_SPEC=../astro/apps/core/docs/public/public_v1alpha1.yaml
OUTPUT ?= astro
# golangci-lint version
GOLANGCI_LINT_VERSION ?=v1.50.1
lint:
@test -f ${ENVTEST_ASSETS_DIR}/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${ENVTEST_ASSETS_DIR} ${GOLANGCI_LINT_VERSION}
${ENVTEST_ASSETS_DIR}/golangci-lint version
${ENVTEST_ASSETS_DIR}/golangci-lint run --timeout 3m0s
build:
go build -o ${OUTPUT} -ldflags "${LDFLAGS_VERSION}" main.go
core_api_gen:
ifeq (, $(shell which oapi-codegen))
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
endif
oapi-codegen -include-tags=User,Organization,Invite -generate=types,client -package=astrocore "${CORE_OPENAPI_SPEC}" > ./astro-client-core/api.gen.go
make mock_astro_core
test:
go test -count=1 -cover $(shell go list ./... | grep -v e2e)
go test -coverprofile=coverage.txt -covermode=atomic $(shell go list ./... | grep -v e2e)
e2e_test:
go test -count=1 $(shell go list ./... | grep e2e)
mock: mock_airflow mock_houston mock_astro mock_pkg mock_sql_cli mock_astro_core
mock_houston:
mockery --filename=ClientInterface.go --output=houston/mocks --dir=houston --outpkg=houston_mocks --name ClientInterface
mock_airflow:
mockery --filename=RegistryHandler.go --output=airflow/mocks --dir=airflow --outpkg=mocks --name RegistryHandler
mockery --filename=ImageHandler.go --output=airflow/mocks --dir=airflow --outpkg=mocks --name ImageHandler
mockery --filename=ContainerHandler.go --output=airflow/mocks --dir=airflow --outpkg=mocks --name ContainerHandler
mockery --filename=DockerComposeAPI.go --output=airflow/mocks --dir=airflow --outpkg=mocks --name DockerComposeAPI
mockery --filename=DockerRegistryAPI.go --output=airflow/mocks --dir=airflow --outpkg=mocks --name DockerRegistryAPI
mockery --filename=DockerCLIClient.go --output=airflow/mocks --dir=airflow --outpkg=mocks --name DockerCLIClient
mock_astro:
mockery --filename=Client.go --output=astro-client/mocks --dir=astro-client --outpkg=astro_mocks --name Client
mock_astro_core:
mockery --filename=client.go --output=astro-client-core/mocks --dir=astro-client-core --outpkg=astrocore_mocks --name ClientWithResponsesInterface
mock_pkg:
mockery --filename=Azure.go --output=pkg/azure/mocks --dir=pkg/azure --outpkg=azure_mocks --name Azure
mock_sql_cli:
mockery --filename="docker_interface.go" --output="sql/mocks" --dir=sql/ --outpkg=mocks --name DockerBind
mockery --filename="io_interface.go" --output="sql/mocks" --dir=sql/ --outpkg=mocks --name IoBind
mockery --filename="os_interface.go" --output="sql/mocks" --dir=sql/ --outpkg=mocks --name OsBind
codecov:
@eval $$(curl -s https://codecov.io/bash)