Skip to content

Commit

Permalink
Use link-validator; configure JavaDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ennru committed Sep 23, 2024
1 parent 73cc7eb commit f85e9f9
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 10 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/link-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Link Validator

on:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 6 * * 1'

permissions:
contents: read

jobs:
validate-links:
runs-on: ubuntu-22.04
if: github.repository == 'akka/akka-management'
steps:
- name: Checkout
# https://github.com/actions/checkout/releases
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
# See https://github.com/actions/checkout/issues/299#issuecomment-677674415
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 100

- name: Fetch tags
run: git fetch --depth=100 origin +refs/tags/*:refs/tags/*

- name: Cache Coursier cache
# https://github.com/coursier/cache-action/releases
# v6.4.5
uses: coursier/cache-action@1ff273bff02a8787bc9f1877d347948af647956d

- name: Set up JDK 11
# https://github.com/coursier/setup-action/releases
# v1.3.5
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f
with:
jvm: temurin:1.11.0
apps: cs

- name: sbt site
run: sbt docs/makeSite

- name: Run Link Validator
run: cs launch net.runne::site-link-validator:0.2.5 -- scripts/link-validator.conf
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ To build and publish the image run the following. The Docker username and regist

Note that the registry to push to must include the username, for example `-Ddocker.registry=docker.io/youruser`.

Security information (i.e. user and password) can be specified in multiple ways as described in section [docker-maven-plugin authentication](http://dmp.fabric8.io/#authentication).
Security information (i.e. user and password) can be specified in multiple ways as described in section [docker-maven-plugin authentication](https://dmp.fabric8.io/#authentication).

```
mvn -Ddocker.username=<user> -Ddocker.registry=<registry>/<user> package docker:push
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/paradox/kubernetes-deployment/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ for 'hello world':

kubectl expose deployment appka --type=LoadBalancer --name=appka-service

You can inspect the Akka Cluster membership status with the [Cluster HTTP Management](https://doc.akka.io/libraries/akka-management/current/cluster-http-management.html).
You can inspect the Akka Cluster membership status with the @ref:[Cluster HTTP Management](../cluster-http-management.md).

curl http://127.0.0.1:8558/cluster/members/

2 changes: 1 addition & 1 deletion docs/src/main/paradox/loglevels/logback.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Dynamic Log Levels for Logback hooks into Akka Management and provides a route w

@@project-info{ projectId="loglevels-logback" }

Requires @ref:[Akka Management](../akka-management.md) and that the application uses [Logback](http://logback.qos.ch) as logging backend.
Requires @ref:[Akka Management](../akka-management.md) and that the application uses [Logback](https://logback.qos.ch) as logging backend.

The Akka dependencies are available from Akka's library repository. To access them there, you need to configure the URL for this repository.

Expand Down
15 changes: 12 additions & 3 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,18 @@ object Common extends AutoPlugin {
"-doc-version",
version.value
) ++
// for some reason Scaladoc creates this
(if (scalaVersion.value.startsWith("3")) Seq.empty
else Seq("-skip-packages", "akka.pattern")),
// make use of https://github.com/scala/scala/pull/8663
(if (scalaBinaryVersion.value.startsWith("3")) {
Seq(s"-external-mappings:https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api/java.base/") // different usage in scala3
} else if (scalaBinaryVersion.value.startsWith("2.13")) {
Seq(
"-jdk-api-doc-base",
s"https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api/java.base/",
// for some reason Scaladoc creates this
"-skip-packages",
"akka.pattern"
)
} else Nil),
Compile / doc / scalacOptions ++= Seq(
"-doc-source-url", {
val branch = if (isSnapshot.value) "master" else s"v${version.value}"
Expand Down
4 changes: 4 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import sbt.*

object Dependencies {

// Java Platform version for JavaDoc creation
// sync with Java version in .github/workflows/release.yml#documentation
lazy val JavaDocLinkVersion = 17

val Scala213 = "2.13.14"
val Scala3 = "3.3.3"
val CrossScalaVersions = Seq(Scala213, Scala3)
Expand Down
4 changes: 0 additions & 4 deletions project/project-info.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ project-info {
text: "Lightbend Discuss"
url: "https://discuss.lightbend.com/c/akka/"
}
{
text: "akka/akka Gitter channel"
url: "https://gitter.im/akka/akka"
}
]
api-docs: [
{
Expand Down
35 changes: 35 additions & 0 deletions scripts/link-validator.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// config for https://github.com/ennru/site-link-validator/
site-link-validator {
root-dir = "./docs/target/site/"
# relative to `root-dir`
start-file = "libraries/akka-management/snapshot/index.html"

# Resolves URLs with the given prefix as local files instead
link-mappings = [
{
prefix = "https://doc.akka.io/libraries/akka-management/snapshot/"
replace = "/libraries/akka-management/snapshot/"
}
{
prefix = "https://doc.akka.io/api/akka-management/snapshot/"
replace = "/api/akka-management/snapshot/"
}
]

ignore-missing-local-files-regex = ""

ignore-files = []

ignore-prefixes = [
# GitHub will block with "429 Too Many Requests"
"https://github.com/akka/akka-management/"
# MVN repository forbids access after a few requests
"https://mvnrepository.com/artifact/",
"https://repo.akka.io/",
"http://127.0.0.1:8080"
]

non-https-whitelist = [
"http://logback.qos.ch/"
]
}

0 comments on commit f85e9f9

Please sign in to comment.