Skip to content

Commit fdc31d2

Browse files
authored
Merge pull request #14815 from dotty-staging/scaladoc/links-test
Add tests checking whether the links haven't changed
2 parents 769b645 + ff5115c commit fdc31d2

File tree

5 files changed

+2202
-4
lines changed

5 files changed

+2202
-4
lines changed

.github/workflows/scaladoc.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ jobs:
5252
- name: Generate testcases documentation
5353
run: ./project/scripts/sbt scaladoc/generateTestcasesDocumentation
5454

55-
- name: Generate reference documentation
56-
run: ./project/scripts/sbt scaladoc/generateReferenceDocumentation
55+
- name: Generate reference documentation and check links stability
56+
run: |
57+
./project/scripts/sbt scaladoc/generateReferenceDocumentation
58+
./project/scripts/docsLinksStability ./scaladoc/output/reference ./project/scripts/expected-links/reference-expected-links.txt
5759
58-
- name: Generate Scala 3 documentation
59-
run: ./project/scripts/sbt scaladoc/generateScalaDocumentation
60+
- name: Generate Scala 3 documentation and check links stability
61+
run: |
62+
./project/scripts/sbt scaladoc/generateScalaDocumentation
63+
./project/scripts/docsLinksStability ./scaladoc/output/scala3 ./project/scripts/expected-links/scala3-expected-links.txt
6064
6165
- name: Generate documentation for example project using dotty-sbt
6266
run: ./project/scripts/sbt "sbt-test/scripted sbt-dotty/scaladoc"

project/scripts/docsLinksStability

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -u
3+
4+
echo "Testing links stability in documentation"
5+
6+
DOCS_DIR=$1 # The location of documentation is passed as a first parameter
7+
8+
EXPECTED_LINKS_FILE=$2 # The location of expected-links.txt is passed as a second parameter
9+
10+
pushd $DOCS_DIR > /dev/null # Go to docs dir but remember previous location
11+
# We need to go to docs dir to make find return correct relative paths
12+
find . -type f -name "*.html" | sort | (popd > /dev/null; diff $EXPECTED_LINKS_FILE -;)
13+
# We list every html file in documentation, then sort it and finally compare to the expected links list.
14+
# Before running diff we need to popd to return to the previous location because we don't have relative path to the expected links file.
15+
16+
if [ ! $? -eq 0 ]
17+
then
18+
echo "Links changed. If it's intentional, regenerate expected links list by running ./project/scripts/regenerateExpectedLinks $1 $2"
19+
exit -1
20+
else
21+
echo "Links OK!"
22+
exit 0
23+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
./changed-features/compiler-plugins.html
2+
./changed-features/eta-expansion-spec.html
3+
./changed-features/eta-expansion.html
4+
./changed-features/implicit-conversions-spec.html
5+
./changed-features/implicit-conversions.html
6+
./changed-features/implicit-resolution.html
7+
./changed-features/imports.html
8+
./changed-features/index.html
9+
./changed-features/lazy-vals-init.html
10+
./changed-features/main-functions.html
11+
./changed-features/match-syntax.html
12+
./changed-features/numeric-literals.html
13+
./changed-features/operators.html
14+
./changed-features/overload-resolution.html
15+
./changed-features/pattern-bindings.html
16+
./changed-features/pattern-matching.html
17+
./changed-features/structural-types-spec.html
18+
./changed-features/structural-types.html
19+
./changed-features/type-checking.html
20+
./changed-features/type-inference.html
21+
./changed-features/vararg-splices.html
22+
./changed-features/wildcards.html
23+
./contextual/by-name-context-parameters.html
24+
./contextual/context-bounds.html
25+
./contextual/context-functions-spec.html
26+
./contextual/context-functions.html
27+
./contextual/conversions.html
28+
./contextual/derivation-macro.html
29+
./contextual/derivation.html
30+
./contextual/extension-methods.html
31+
./contextual/given-imports.html
32+
./contextual/givens.html
33+
./contextual/index.html
34+
./contextual/multiversal-equality.html
35+
./contextual/relationship-implicits.html
36+
./contextual/right-associative-extension-methods.html
37+
./contextual/type-classes.html
38+
./contextual/using-clauses.html
39+
./docs/reference/other-new-features/named-typeargs.html
40+
./docsScalaLangResources/scaladoc-assets.html
41+
./dropped-features/auto-apply.html
42+
./dropped-features/class-shadowing-spec.html
43+
./dropped-features/class-shadowing.html
44+
./dropped-features/delayed-init.html
45+
./dropped-features/do-while.html
46+
./dropped-features/early-initializers.html
47+
./dropped-features/existential-types.html
48+
./dropped-features/index.html
49+
./dropped-features/limit22.html
50+
./dropped-features/macros.html
51+
./dropped-features/nonlocal-returns.html
52+
./dropped-features/package-objects.html
53+
./dropped-features/procedure-syntax.html
54+
./dropped-features/symlits.html
55+
./dropped-features/this-qualifier.html
56+
./dropped-features/type-projection.html
57+
./dropped-features/weak-conformance-spec.html
58+
./dropped-features/weak-conformance.html
59+
./dropped-features/wildcard-init.html
60+
./dropped-features/xml.html
61+
./enums/adts.html
62+
./enums/desugarEnums.html
63+
./enums/enums.html
64+
./enums/index.html
65+
./experimental/canthrow.html
66+
./experimental/cc.html
67+
./experimental/erased-defs-spec.html
68+
./experimental/erased-defs.html
69+
./experimental/explicit-nulls.html
70+
./experimental/index.html
71+
./experimental/named-typeargs-spec.html
72+
./experimental/named-typeargs.html
73+
./experimental/numeric-literals.html
74+
./experimental/overview.html
75+
./features-classification.html
76+
./index.html
77+
./language-versions/binary-compatibility.html
78+
./language-versions/index.html
79+
./language-versions/source-compatibility.html
80+
./metaprogramming/compiletime-ops.html
81+
./metaprogramming/index.html
82+
./metaprogramming/inline.html
83+
./metaprogramming/macros-spec.html
84+
./metaprogramming/macros.html
85+
./metaprogramming/reflection.html
86+
./metaprogramming/staging.html
87+
./metaprogramming/tasty-inspect.html
88+
./new-types/dependent-function-types-spec.html
89+
./new-types/dependent-function-types.html
90+
./new-types/index.html
91+
./new-types/intersection-types-spec.html
92+
./new-types/intersection-types.html
93+
./new-types/match-types.html
94+
./new-types/polymorphic-function-types.html
95+
./new-types/type-lambdas-spec.html
96+
./new-types/type-lambdas.html
97+
./new-types/union-types-spec.html
98+
./new-types/union-types.html
99+
./other-new-features/control-syntax.html
100+
./other-new-features/creator-applications.html
101+
./other-new-features/experimental-defs.html
102+
./other-new-features/export.html
103+
./other-new-features/indentation.html
104+
./other-new-features/index.html
105+
./other-new-features/kind-polymorphism.html
106+
./other-new-features/matchable.html
107+
./other-new-features/opaques-details.html
108+
./other-new-features/opaques.html
109+
./other-new-features/open-classes.html
110+
./other-new-features/parameter-untupling-spec.html
111+
./other-new-features/parameter-untupling.html
112+
./other-new-features/safe-initialization.html
113+
./other-new-features/targetName.html
114+
./other-new-features/threadUnsafe-annotation.html
115+
./other-new-features/trait-parameters.html
116+
./other-new-features/transparent-traits.html
117+
./other-new-features/type-test.html
118+
./overview.html
119+
./soft-modifier.html
120+
./syntax.html

0 commit comments

Comments
 (0)