Skip to content

Commit

Permalink
Fail CI if the docs are outdated (#961)
Browse files Browse the repository at this point in the history
* Fail CI if the docs are outdated

* Add and use test that the docs are up to date

* Add EOL

---------

Co-authored-by: Corbin McNeely-Smith <restingbull@mcneely-smith.com>
Co-authored-by: Corbin McNeely-Smith <58151731+restingbull@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 10, 2023
1 parent b67dd8d commit 2f2b7a9
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ tasks:
platform: ubuntu1804
build_targets:
- //kotlin:stardoc
test_targets:
- //docs:are_docs_up_to_date_test
ktlint:
name: KtLint
platform: ubuntu1804
Expand Down
12 changes: 12 additions & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sh_test(
name = "are_docs_up_to_date_test",
srcs = ["are_docs_up_to_date_test.sh"],
args = [
"$(location kotlin.md)",
"$(location //kotlin:stardoc)",
],
data = [
"kotlin.md",
"//kotlin:stardoc",
],
)
13 changes: 13 additions & 0 deletions docs/are_docs_up_to_date_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

function fail {
echo >&2 "##### $1 ######"
exit 1
}

current="$1"
new="$2"
[[ -f $new ]] || fail "missing new docs"
[[ -f $current ]] || fail "missing current docs"

diff -u "$1" "$2" || fail "kotlin docs are out of date"
Loading

0 comments on commit 2f2b7a9

Please sign in to comment.