|
1 | | - |
2 | 1 | # Image URL to use all building/pushing image targets |
3 | 2 | IMG ?= fluxcd/source-controller:latest |
4 | 3 | # Produce CRDs that work back to Kubernetes 1.13 |
|
14 | 13 | all: manager |
15 | 14 |
|
16 | 15 | # Run tests |
17 | | -test: generate fmt vet manifests |
| 16 | +test: generate fmt vet manifests api-docs |
18 | 17 | go test ./... -coverprofile cover.out |
19 | 18 |
|
20 | 19 | # Build manager binary |
@@ -49,6 +48,10 @@ dev-deploy: manifests |
49 | 48 | manifests: controller-gen |
50 | 49 | $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=config/crd/bases |
51 | 50 |
|
| 51 | +# Generate API reference documentation |
| 52 | +api-docs: gen-crd-api-reference-docs |
| 53 | + $(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/source.md |
| 54 | + |
52 | 55 | # Run go fmt against code |
53 | 56 | fmt: |
54 | 57 | go fmt ./... |
@@ -84,3 +87,19 @@ CONTROLLER_GEN=$(GOBIN)/controller-gen |
84 | 87 | else |
85 | 88 | CONTROLLER_GEN=$(shell which controller-gen) |
86 | 89 | endif |
| 90 | + |
| 91 | +# Find or download gen-crd-api-reference-docs |
| 92 | +gen-crd-api-reference-docs: |
| 93 | +ifeq (, $(shell which gen-crd-api-reference-docs)) |
| 94 | + @{ \ |
| 95 | + set -e ;\ |
| 96 | + API_REF_GEN_TMP_DIR=$$(mktemp -d) ;\ |
| 97 | + cd $$API_REF_GEN_TMP_DIR ;\ |
| 98 | + go mod init tmp ;\ |
| 99 | + go get github.com/ahmetb/ [email protected] ;\ |
| 100 | + rm -rf $$API_REF_GEN_TMP_DIR ;\ |
| 101 | + } |
| 102 | +API_REF_GEN=$(GOBIN)/gen-crd-api-reference-docs |
| 103 | +else |
| 104 | +API_REF_GEN=$(shell which gen-crd-api-reference-docs) |
| 105 | +endif |
0 commit comments