-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathMakefile
More file actions
167 lines (134 loc) · 5.6 KB
/
Copy pathMakefile
File metadata and controls
167 lines (134 loc) · 5.6 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
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
.PHONY: clean
clean:
./scripts/clean.sh
.PHONY: ensure
ensure:
./scripts/ensure.sh
$(MAKE) sync-icons
.PHONY: lint
lint: lint-go lint-markdown lint-dark-logos
yarn run lint
# The `-on-dark.svg` package marks are generated, so a new or replaced logo silently
# leaves them stale. This check is deterministic and offline, so it belongs here;
# its sibling scripts/classify-external-logos.py needs the network and is not run by
# `make lint`. See the "Dark Mode" section of AGENTS.md.
.PHONY: lint-dark-logos
lint-dark-logos:
python3 ./scripts/generate-dark-logos.py --check
.PHONY: lint-markdown
lint-markdown: lint-shortcode-delimiters
./scripts/lint/lint-markdown.js
# The auto-generated provider _index.md pages are skipped by the front-matter
# linter, yet a single malformed shortcode delimiter there fails the whole site build.
.PHONY: lint-shortcode-delimiters
lint-shortcode-delimiters:
./scripts/lint/check-shortcode-delimiters.js
.PHONY: lint-go
lint-go: lint-resourcedocsgen
.PHONY: lint-resourcedocsgen
lint-resourcedocsgen:
cd tools/resourcedocsgen/ && golangci-lint run --config ../../.golangci.yml
.PHONY: test
test: test-infra test-preview-comment
cd ./tools/resourcedocsgen && go test ./...
.PHONY: test-infra
test-infra:
cd infrastructure && node --test redirects.test.js
# Covers the URL mapping behind the pinned preview comment in scripts/ci/sync.sh. Offline
# and dependency-free, so it runs alongside the script linter in PR CI.
.PHONY: test-preview-comment
test-preview-comment:
./scripts/ci/test-preview-comment.sh
.PHONY: build
build: build-assets
node scripts/apply-fixes.js
hugo 2>&1 | grep -v -e 'WARN .* REF_NOT_FOUND'
node scripts/split-sitemap.js
HUGO_SERVE := hugo serve --buildDrafts --buildFuture --ignoreVendorPaths="github.com/pulumi/registry/**/*" 2>&1 | grep -v -e 'WARN .* REF_NOT_FOUND'
HELPMAKEGO_VERSION := v0.1.0
HELPMAKEGO := bin/${HELPMAKEGO_VERSION}/helpmakego
# Ensure that `helpmakego` is installed at ${HELPMAKEGO} before it is used to resolve targets.
#
# This has the side effect of ensuring that the `bin` directory is present.
_ := $(shell if ! [ -x ${HELPMAKEGO} ]; then \
GOBIN=$(shell pwd)/bin/${HELPMAKEGO_VERSION} go install github.com/iwahbe/helpmakego@${HELPMAKEGO_VERSION}; \
fi \
)
DOCSGEN_SRC_HASH := $(shell find tools/resourcedocsgen -name '*.go' -o -name '*.tmpl' -o -name 'go.sum' | sort | xargs sha256sum | sha256sum | cut -d' ' -f1)
bin/resourcedocsgen: $(shell ${HELPMAKEGO} tools/resourcedocsgen)
go build -C tools/resourcedocsgen -ldflags "-X github.com/pulumi/registry/tools/resourcedocsgen/cmd/docs.sourceHash=$(DOCSGEN_SRC_HASH)" -o ../../bin ./...
# Generate API docs for all packages, then versioned docs for blessed packages.
# Set SKIP_VERSIONED_DOCS=1 to skip versioned docs generation (e.g. when running in a parallel CI job).
.PHONY: api-docs
api-docs: bin/resourcedocsgen
bin/resourcedocsgen docs registry \
--baseDocsOutDir ./themes/default/content/registry/packages \
--basePackageTreeJSONOutDir ./themes/default/static/registry/packages/navs \
--baseSchemasOutDir ./themes/default/static/registry/packages \
--baseLLMDocsOutDir ./llm-docs-out/registry/packages
$(if $(SKIP_VERSIONED_DOCS),,./scripts/generate-versioned-docs.sh)
# Generate the API docs for `content/registry/packages/<pkg>`, where <pkg> is the name of
# the package to be handed off to resourcedocsgen.
.SECONDEXPANSION: # Needed for content/registry/packages/% to have dependencies that reference %.
api-docs/%: .make/content/registry/packages/$$*/api-docs ;
.make/content/registry/packages/%/api-docs: bin/resourcedocsgen \
themes/default/data/registry/packages/%.yaml \
scripts/generate-versioned-docs.sh \
$$(wildcard themes/default/content/registry/packages/%/*)
@if [ -L ./content/registry/packages/$* ]; then rm ./content/registry/packages/$*; fi
@if [ -L ./static/registry/packages/navs/$*.json ]; then rm ./static/registry/packages/navs/$*.json; fi
bin/resourcedocsgen docs registry \
--baseDocsOutDir ./content/registry/packages \
--basePackageTreeJSONOutDir ./static/registry/packages/navs \
--baseSchemasOutDir ./static/registry/packages \
--baseLLMDocsOutDir ./llm-docs-out/registry/packages \
$*
$(if $(SKIP_VERSIONED_DOCS),,CONTENT_DIR=$(CURDIR)/content/registry/packages STATIC_DIR=$(CURDIR)/static/registry/packages ./scripts/generate-versioned-docs.sh $*)
@mkdir -p "$(@D)"
@touch $@
# Run hugo locally, ignoring REF_NOT_FOUND warnings
.PHONY: serve
serve:
${HUGO_SERVE}
.PHONY: ci-pull-request
ci-pull-request: ensure
./scripts/ci/pull-request.sh
.PHONY: ci-pull-request-closed
ci-pull-request-closed:
./scripts/ci/pull-request-closed.sh
.PHONY: ci-scheduled
ci-scheduled:
./scripts/ci/scheduled.sh
.PHONY: ci_push
ci_push:: ensure
./scripts/ci/push.sh
.PHONY: serve-assets
serve-assets:
yarn --cwd ./themes/default/theme run start
.PHONY: serve-all
serve-all:
./node_modules/.bin/concurrently --kill-others -r "${HUGO_SERVE}" "yarn --cwd ./themes/default/theme run start"
.PHONY: sync-icons
sync-icons:
node scripts/sync-icons.js
.PHONY: build-icon-sprite
build-icon-sprite:
node scripts/build-icon-sprite.js
.PHONY: fetch-github-stars
fetch-github-stars:
node scripts/fetch-github-stars.js
.PHONY: build-assets
build-assets: ensure build-icon-sprite fetch-github-stars
yarn --cwd ./themes/default/theme run build
.PHONY: ci_bucket_cleanup
ci_bucket_cleanup:
./scripts/ci/bucket-cleanup.sh
.PHONY: check_links
check_links: ensure
yarn run check-links
.PHONY: test_provider_api_docs
test_provider_api_docs: ensure build-assets bin/resourcedocsgen
./scripts/ci/run-provider-tests.sh
.PHONY: run-browser-tests
run-browser-tests: ensure
./scripts/run-api-docs-tests.sh