Skip to content

Commit 7dc07e7

Browse files
authored
docs: Add http/openapi documentation & ci workflow (#2678)
## Relevant issue(s) Related #510 Resolve #2677 ## Description - Detect OpenAPI / HTTP documentation is always up to date. - Generate open-api docs in the appropriate dir. ## How has this been tested? - using `act` tool - manually introducing a change and seeing the action fail: https://github.com/sourcenetwork/defradb/actions/runs/9359749777/job/25763961265?pr=2678 Specify the platform(s) on which this was tested: - WSL2 instance
1 parent 1eb1fb5 commit 7dc07e7

File tree

4 files changed

+2151
-9
lines changed

4 files changed

+2151
-9
lines changed

.github/workflows/check-cli-documentation.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ jobs:
3535
- name: Checkout code into the directory
3636
uses: actions/checkout@v3
3737

38-
# This check is there as a safety to ensure we start clean (without any changes).
39-
# If there are ever changes here, the rest of the job will output false result.
40-
- name: Check no changes exist initially
41-
uses: tj-actions/verify-changed-files@v20
42-
with:
43-
fail-if-changed: true
44-
files: |
45-
docs/website/references/cli
46-
4738
- name: Setup Go environment explicitly
4839
uses: actions/setup-go@v3
4940
with:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2024 Democratized Data Foundation
2+
#
3+
# Use of this software is governed by the Business Source License
4+
# included in the file licenses/BSL.txt.
5+
#
6+
# As of the Change Date specified in that file, in accordance with
7+
# the Business Source License, use of this software will be governed
8+
# by the Apache License, Version 2.0, included in the file
9+
# licenses/APL.txt.
10+
11+
# This workflow checks that all HTTP documentation is up to date.
12+
# If the documentation is not up to date then this action will fail.
13+
name: Check HTTP Documentation Workflow
14+
15+
on:
16+
pull_request:
17+
branches:
18+
- master
19+
- develop
20+
21+
push:
22+
tags:
23+
- 'v[0-9]+.[0-9]+.[0-9]+'
24+
branches:
25+
- master
26+
- develop
27+
28+
jobs:
29+
check-http-documentation:
30+
name: Check http documentation job
31+
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- name: Checkout code into the directory
36+
uses: actions/checkout@v3
37+
38+
- name: Setup Go environment explicitly
39+
uses: actions/setup-go@v3
40+
with:
41+
go-version: "1.21"
42+
check-latest: true
43+
44+
- name: Try generating http documentation
45+
run: make docs:http
46+
47+
- name: Check no new changes exist
48+
uses: tj-actions/verify-changed-files@v20
49+
with:
50+
fail-if-changed: true
51+
files: |
52+
docs/website/references/http

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,17 @@ chglog:
356356
docs:
357357
@$(MAKE) docs\:cli
358358
@$(MAKE) docs\:manpages
359+
@$(MAKE) docs\:http
359360

360361
.PHONY: docs\:cli
361362
docs\:cli:
362363
rm -f docs/website/references/cli/*.md
363364
go run cmd/genclidocs/main.go -o docs/website/references/cli
364365

366+
.PHONY: docs\:http
367+
docs\:http:
368+
go run cmd/genopenapi/main.go | python -m json.tool > docs/website/references/http/openapi.json
369+
365370
.PHONY: docs\:manpages
366371
docs\:manpages:
367372
go run cmd/genmanpages/main.go -o build/man/

0 commit comments

Comments
 (0)