Skip to content

Commit

Permalink
validate links (#70)
Browse files Browse the repository at this point in the history
* validate links

* try to fix links

* scalafmt

* Update build.sbt

* continuing build issues

* Update link-validator.conf
  • Loading branch information
pjfanning authored Nov 6, 2023
1 parent d112d0d commit 0c80f90
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
- name: Check project is formatted
uses: jrouly/scalafmt-native-action@v2
with:
version: '3.7.1'
version: '3.7.11'
arguments: '--list --mode diff-ref=origin/main'
41 changes: 41 additions & 0 deletions .github/workflows/link-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Link Validator

permissions: {}

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

jobs:
validate-links:
runs-on: ubuntu-20.04
if: github.repository == 'apache/incubator-pekko-persistence-r2dbc'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Setup Java 8
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8

- name: Cache Coursier cache
uses: coursier/[email protected]

- name: Setup Coursier
uses: coursier/[email protected]

- name: Create the Pekko site
run: sbt "unidoc; docs/paradox"

- name: Run Link Validator
run: cs launch net.runne::site-link-validator:0.2.2 -- scripts/link-validator.conf
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.7.1
version = 3.7.11
runner.dialect = scala213
project.git = true
style = defaultWithAlign
Expand Down
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ lazy val docs = project
"extref.pekko-projection.base_url" -> s"https://pekko.apache.org/docs/pekko-projection/${Dependencies.PekkoProjectionVersionInDocs}/%s",
"extref.java-docs.base_url" -> "https://docs.oracle.com/en/java/javase/11/%s",
"scaladoc.scala.base_url" -> s"https://www.scala-lang.org/api/current/",
"scaladoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/api/pekko/${Dependencies.PekkoVersion}",
"scaladoc.org.apache.pekko.persistence.r2dbc.base_url" ->
s"https://pekko.apache.org/api/pekko-persistence-r2dbc/${Dependencies.PekkoPersistenceR2dbcVersionInDocs}",
"scaladoc.org.apache.pekko.projection.r2dbc.base_url" ->
s"https://pekko.apache.org/api/pekko-persistence-r2dbc/${Dependencies.PekkoPersistenceR2dbcVersionInDocs}",
"scaladoc.org.apache.pekko.projection.base_url" ->
s"https://pekko.apache.org/api/pekko-projection/${Dependencies.PekkoProjectionVersionInDocs}",
"scaladoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/api/pekko/${Dependencies.PekkoVersionInDocs}",
"scaladoc.com.typesafe.config.base_url" -> s"https://lightbend.github.io/config/latest/api/"),
apidocRootPackage := "org.apache.pekko",
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/paradox/projection.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Same type of handlers can be used with `R2dbcProjection` instead of `CassandraPr
### Actor handler

A good alternative for advanced state management is to implement the handler as an
@extref:[actor](pekko:typed/typed/actors.html) which is described in
@extref:[actor](pekko:typed/actors.html) which is described in
@extref:[Processing with Actor](pekko-projection:actor.html).

### Flow handler
Expand All @@ -228,7 +228,7 @@ The supported offset types of the `R2dbcProjection` are:

* @apidoc[pekko.persistence.query.TimestampOffset] that is used for @extref:[SourceProvider for eventsBySlices](pekko-projection:eventsourced.html#sourceprovider-for-eventsbyslices) and @extref:[SourceProvider for changesBySlices](pekko-projection:durable-state.html#sourceprovider-for-changesbyslices)
* other @apidoc[pekko.persistence.query.Offset] types
* @apidoc[MergeableOffset] that is used for @extref:[messages from Kafka](pekko-projection:kafka.md#mergeable-offset)
* @apidoc[MergeableOffset] that is used for @extref:[messages from Kafka](pekko-projection:kafka.html#mergeable-offset)
* `String`
* `Int`
* `Long`
Expand Down
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ object Dependencies {
val PekkoVersion = System.getProperty("override.pekko.version", "1.0.1")
val PekkoVersionInDocs = "1.0"
val PekkoPersistenceJdbcVersion = "1.0.0"
val PekkoPersistenceR2dbcVersionInDocs = "1.0"
val PekkoProjectionVersion = "1.0.0"
val PekkoProjectionVersionInDocs = "1.0"

Expand Down
54 changes: 54 additions & 0 deletions scripts/link-validator.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// config for https://github.com/ennru/site-link-validator/
site-link-validator {
root-dir = "docs/target/paradox/site/main/"
# relative to `root-dir`
start-file = "index.html"

# Resolves URLs with the given prefix as local files instead
link-mappings = [
{
prefix = "https://pekko.apache.org/docs/pekko/current/"
replace = ""
}
# ScalaDoc from unidoc
{
prefix = "https://pekko.apache.org/api/pekko-persistence-r2dbc/current/"
replace = "/../../../../../target/scala-2.13/unidoc/"
}
{
prefix = "https://pekko.apache.org/api/pekko-persistence-r2dbc/current/"
replace = "/../../../../../target/scala-2.13/unidoc/"
}
{
prefix = "https://pekko.apache.org/api/pekko-persistence-r2dbc/snapshot/"
replace = "/../../../../../target/scala-2.13/unidoc/"
}
]

ignore-missing-local-files-regex = ""
// e.g. "^api/alpakka/snapshot/pekko/stream/alpakka/googlecloud/storage/impl/Formats.*"

ignore-prefixes = [
# broken links for license report
"http://asm.objectweb.org"
"https://r2dbc.io/r2dbc-spi"
]

non-https-whitelist = [
# http links in license report
"http://github.com/jnr/"
"http://github.com/slick/slick/blob/master/LICENSE.txt"
"http://junit.org"
"http://opensource.org/licenses/"
"http://www.opensource.org/licenses/"
"http://slick.typesafe.com"
"http://www.apache.org/licenses/"
"http://www.eclipse.org/legal/epl-v10.html"
"http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
"http://www.reactive-streams.org/"
"http://www.scala-lang.org/"
"http://www.scalatest.org"
"http://www.slf4j.org"
]

}

0 comments on commit 0c80f90

Please sign in to comment.