Skip to content

Commit

Permalink
Merge pull request #496 from armanbilge/feature/steward-config-validator
Browse files Browse the repository at this point in the history
Add steward config validator CI job
  • Loading branch information
armanbilge committed Apr 22, 2023
2 parents fbcd01c + 7188547 commit 9106a7e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,40 @@ jobs:
- name: Publish
run: sbt '++ ${{ matrix.scala }}' tlCiRelease

validate-steward:
name: Validate Steward Config
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.6]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (fast)
uses: actions/checkout@v3

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- uses: coursier/setup-action@v1
with:
apps: scala-steward

- run: scala-steward validate-repo-config .scala-steward.conf

site:
name: Generate Site
strategy:
Expand Down
26 changes: 25 additions & 1 deletion ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ object TypelevelCiPlugin extends AutoPlugin {
settingKey[Boolean]("Whether to do MiMa binary issues check in CI (default: true)")
lazy val tlCiDocCheck =
settingKey[Boolean]("Whether to build API docs in CI (default: true)")

lazy val tlCiStewardValidateConfig = settingKey[Option[File]](
"The location of the Scala Steward config to validate (default: `.scala-steward.conf`, if exists)")

}

import autoImport._
Expand Down Expand Up @@ -123,7 +127,27 @@ object TypelevelCiPlugin extends AutoPlugin {

style ++ test ++ scalafix ++ mima ++ doc
},
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8"))
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")),
tlCiStewardValidateConfig :=
Some(file(".scala-steward.conf")).filter(_.exists()),
githubWorkflowAddedJobs ++= {
tlCiStewardValidateConfig
.value
.toList
.map { config =>
WorkflowJob(
"validate-steward",
"Validate Steward Config",
WorkflowStep.Checkout ::
WorkflowStep.SetupJava(List(JavaSpec.temurin("17"))) :::
WorkflowStep.Use(
UseRef.Public("coursier", "setup-action", "v1"),
Map("apps" -> "scala-steward")
) ::
WorkflowStep.Run(List(s"scala-steward validate-repo-config $config")) :: Nil
)
}
}
)

override def projectSettings: Seq[Setting[_]] = Seq(
Expand Down

0 comments on commit 9106a7e

Please sign in to comment.