Skip to content

Commit 591ccff

Browse files
authored
docs: configure links in ScalaDoc; run link validator (#602)
1 parent 96f2fe5 commit 591ccff

File tree

6 files changed

+99
-6
lines changed

6 files changed

+99
-6
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Link Validator
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
schedule:
7+
- cron: '0 6 * * 1'
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
validate-links:
14+
runs-on: ubuntu-22.04
15+
if: github.repository == 'akka/akka-persistence-r2dbc'
16+
steps:
17+
- name: Checkout
18+
# https://github.com/actions/checkout/releases
19+
# v4.1.1
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
21+
with:
22+
# See https://github.com/actions/checkout/issues/299#issuecomment-677674415
23+
ref: ${{ github.event.pull_request.head.sha }}
24+
fetch-depth: 100
25+
26+
- name: Fetch tags
27+
run: git fetch --depth=100 origin +refs/tags/*:refs/tags/*
28+
29+
- name: Cache Coursier cache
30+
# https://github.com/coursier/cache-action/releases
31+
# v6.4.5
32+
uses: coursier/cache-action@1ff273bff02a8787bc9f1877d347948af647956d
33+
34+
- name: Set up JDK 17
35+
# https://github.com/coursier/setup-action/releases
36+
# v1.3.5
37+
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f
38+
with:
39+
jvm: temurin:1.17.0.5
40+
apps: cs
41+
42+
- name: sbt site
43+
run: sbt docs/makeSite
44+
45+
- name: Run Link Validator
46+
run: cs launch net.runne::site-link-validator:0.2.5 -- scripts/link-validator.conf

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
# v1.3.5
6363
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f
6464
with:
65-
jvm: temurin:1.11
65+
jvm: temurin:1.17
6666

6767
- name: Publish
6868
run: |-

build.sbt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ def common: Seq[Setting[_]] =
6666
"-Xms1G" :: "-Xmx1G" :: "-XX:MaxDirectMemorySize=256M" :: akkaProperties
6767
},
6868
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
69+
Compile / doc / scalacOptions := scalacOptions.value ++ Seq(
70+
"-doc-title",
71+
"Akka Persistence R2DBC",
72+
"-doc-version",
73+
version.value) ++ {
74+
// make use of https://github.com/scala/scala/pull/8663
75+
if (scalaBinaryVersion.value.startsWith("3")) {
76+
Seq(s"-external-mappings:https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api")
77+
} else {
78+
Seq("-jdk-api-doc-base", s"https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api")
79+
}
80+
},
6981
Global / excludeLintKeys += projectInfoVersion,
7082
Global / excludeLintKeys += mimaReportSignatureProblems,
7183
Global / excludeLintKeys += mimaPreviousArtifacts,
@@ -152,7 +164,7 @@ lazy val docs = project
152164
"extref.akka.base_url" -> s"https://doc.akka.io/libraries/akka-core/${Dependencies.AkkaVersionInDocs}/%s",
153165
"extref.akka-docs.base_url" -> s"https://doc.akka.io/libraries/akka-core/${Dependencies.AkkaVersionInDocs}/%s",
154166
"extref.akka-projection.base_url" -> s"https://doc.akka.io/libraries/akka-projection/${Dependencies.AkkaProjectionVersionInDocs}/%s",
155-
"extref.java-docs.base_url" -> "https://docs.oracle.com/en/java/javase/11/%s",
167+
"extref.java-docs.base_url" -> s"https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/%s",
156168
"scaladoc.scala.base_url" -> s"https://www.scala-lang.org/api/current/",
157169
"scaladoc.akka.persistence.r2dbc.base_url" -> s"/${(Preprocess / siteSubdirName).value}/",
158170
"javadoc.akka.persistence.r2dbc.base_url" -> "", // no Javadoc is published

project/Dependencies.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ object Dependencies {
1717
val R2dbcH2Version = "1.0.0.RELEASE"
1818
val SqlServerR2dbcVersion = "1.0.2.RELEASE"
1919
val SqlServerJdbcVersion = "7.4.1.jre8"
20+
// Java Platform version for JavaDoc creation
21+
// sync with Java version in .github/workflows/release.yml#documentation
22+
val JavaDocLinkVersion = 17
2023

2124
object Compile {
2225
val akkaActorTyped = "com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion

project/project-info.conf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ project-info {
1515
text: "Lightbend Discuss"
1616
url: "https://discuss.lightbend.com/c/akka/"
1717
}
18-
{
19-
text: "akka/akka Gitter channel"
20-
url: "https://gitter.im/akka/akka"
21-
}
2218
]
2319
}
2420
core: ${project-info.shared-info} {

scripts/link-validator.conf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// config for https://github.com/ennru/site-link-validator/
2+
site-link-validator {
3+
root-dir = "./docs/target/site/"
4+
# relative to `root-dir`
5+
start-file = "libraries/akka-persistence-r2dbc/snapshot/index.html"
6+
7+
# Resolves URLs with the given prefix as local files instead
8+
link-mappings = [
9+
{
10+
prefix = "https://doc.akka.io/libraries/akka-persistence-r2dbc/snapshot/"
11+
replace = "/libraries/akka-persistence-r2dbc/snapshot/"
12+
}
13+
{
14+
prefix = "https://doc.akka.io/api/akka-persistence-r2dbc/snapshot/"
15+
replace = "/api/akka-persistence-r2dbc/snapshot/"
16+
}
17+
]
18+
19+
ignore-missing-local-files-regex = ""
20+
21+
ignore-files = []
22+
23+
ignore-prefixes = [
24+
# GitHub will block with "429 Too Many Requests"
25+
"https://github.com/akka/akka-persistence-r2dbc/"
26+
# MVN repository forbids access after a few requests
27+
"https://mvnrepository.com/artifact/",
28+
"https://repo.akka.io/",
29+
# created in api/akka-persistence-r2dbc/snapshot/akka/persistence/r2dbc/internal/Sql$.html
30+
"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String$.html"
31+
]
32+
33+
non-https-whitelist = [
34+
// "http://logback.qos.ch/"
35+
]
36+
}

0 commit comments

Comments
 (0)