Skip to content

Commit

Permalink
Merge pull request #888 from humio/mike/genapidocs
Browse files Browse the repository at this point in the history
Generate markdown API docs for CRD's
  • Loading branch information
SaaldjorMike authored Dec 17, 2024
2 parents faa6439 + ae0a8a5 commit 9558625
Show file tree
Hide file tree
Showing 3 changed files with 36,068 additions and 2 deletions.
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

0 comments on commit 9558625

Please sign in to comment.