Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate markdown API docs for CRD's #888

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ on: push
name: CI
jobs:
checks:
name: Run Tests
name: Run Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.2'
- shell: bash
- name: Generate manifests
shell: bash
run: |
make manifests
if [[ -n $(git status -s) ]] ; then
Expand All @@ -20,6 +21,26 @@ jobs:
git diff
exit 1
fi
- name: Generate API docs
shell: bash
run: |
make apidocs
if [[ -n $(git status -s) ]] ; then
echo "Generating API docs leaves tracked files in a modified state."
echo "Ensure to include updated API docs in this PR."
echo "This is usually done by running 'make apidocs' and running 'git add ...' for the files that was modified by generating manifests."
git status -s
git diff
exit 1
fi
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.2'
- shell: bash
run: |
make test
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,23 @@ ifeq (,$(shell PATH=$$PATH:$(GOBIN) which ginkgo))
endif
GINKGO=$(GOBIN)/ginkgo
endif

.PHONY: crdoc
crdoc:
ifneq (,$(shell which crdoc))
CRDOC=$(shell which crdoc)
else
ifeq (,$(shell PATH=$$PATH:$(GOBIN) which crdoc))
@{ \
set -ex ;\
which go ;\
go version ;\
go install fybrik.io/crdoc@6247ceaefc6bdb5d1a038278477feeda509e4e0c ;\
crdoc --version ;\
}
endif
CRDOC=$(GOBIN)/crdoc
endif

apidocs: manifests crdoc
$(CRDOC) --resources config/crd/bases --output docs/api.md
Loading
Loading