-
-
Notifications
You must be signed in to change notification settings - Fork 57
Add tlCiLintCommands key
#889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,9 @@ object TypelevelCiPlugin extends AutoPlugin { | |
| settingKey[String]( | ||
| "Condition for checking on CI whether this project is a fork of another (default: `github.event.repository.fork == false`)") | ||
|
|
||
| lazy val tlCiLintCommands = settingKey[Seq[String]]( | ||
| "sbt commands run in the 'Check headers and formatting' CI step (default: derived from `tlCiHeaderCheck`, `tlCiScalafmtCheck`, and `tlCiJavafmtCheck`)") | ||
|
|
||
| } | ||
|
|
||
| import autoImport._ | ||
|
|
@@ -69,6 +72,19 @@ object TypelevelCiPlugin extends AutoPlugin { | |
| tlCiDocCheck := false, | ||
| tlCiDependencyGraphJob := true, | ||
| tlCiForkCondition := "github.event.repository.fork == false", | ||
| tlCiLintCommands := { | ||
| val headers = List("headerCheckAll").filter(_ => tlCiHeaderCheck.value) | ||
|
|
||
| val scalafmt = List( | ||
| "scalafmtCheckAll", | ||
| "project /", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, one thing to note, is that |
||
| "scalafmtSbtCheck" | ||
| ).filter(_ => tlCiScalafmtCheck.value) | ||
|
|
||
| val javafmt = List("javafmtCheckAll").filter(_ => tlCiJavafmtCheck.value) | ||
|
|
||
| headers ++ javafmt ++ scalafmt | ||
| }, | ||
| githubWorkflowTargetBranches ++= Seq( | ||
| "!update/**", // ignore steward branches | ||
| "!pr/**" // escape-hatch to disable ci on a branch | ||
|
|
@@ -77,31 +93,15 @@ object TypelevelCiPlugin extends AutoPlugin { | |
| githubWorkflowBuild := { | ||
|
|
||
| val style = { | ||
| val headers = List("headerCheckAll").filter(_ => tlCiHeaderCheck.value) | ||
|
|
||
| val scalafmt = List( | ||
| "scalafmtCheckAll", | ||
| "project /", | ||
| "scalafmtSbtCheck" | ||
| ).filter(_ => tlCiScalafmtCheck.value) | ||
|
|
||
| val javafmt = List("javafmtCheckAll").filter(_ => tlCiJavafmtCheck.value) | ||
|
|
||
| val formatting = javafmt ++ scalafmt | ||
|
|
||
| val headersFormatting = headers ++ formatting | ||
|
|
||
| val names = | ||
| List("headers").filter(_ => headers.nonEmpty) ++ List("formatting").filter(_ => | ||
| formatting.nonEmpty) | ||
| val commands = tlCiLintCommands.value.toList | ||
|
|
||
| List( | ||
| WorkflowStep.Sbt( | ||
| headers ++ formatting, | ||
| name = Some(s"Check ${names.mkString(" and ")}"), | ||
| commands, | ||
| name = Some("Check headers and formatting"), | ||
| cond = Some(primaryAxisCond.value) | ||
| ) | ||
| ).filter(_ => headersFormatting.nonEmpty) | ||
| ).filter(_ => commands.nonEmpty) | ||
| } | ||
|
|
||
| val test = List( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,7 @@ Both plugins are documented in [**sbt-typelevel-github-actions**](gha.md). | |
| - `tlCiDocCheck` (setting): Whether to build API docs in CI (default: `false`). | ||
| - `tlCiDependencyGraphJob` (setting): Whether to add a job to submit dependencies to GH (default: `true`). | ||
| - `tlCiForkCondition` (setting): Condition for checking on CI whether this project is a fork of another (default: `github.event.repository.fork == false`). | ||
| - `tlCiLintCommands` (setting): sbt commands run in the "Check headers and formatting" CI step. Defaults are derived from `tlCiHeaderCheck`, `tlCiScalafmtCheck`, and `tlCiJavafmtCheck`. Append your own check (e.g. `tlCiLintCommands += "myLintCheckAll"`) to fold it into the same step. Scalafix is gated separately via `tlCiScalafixCheck` and runs as its own step. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bikeshedding the name ... the idea is to separate "fast" commands (formatting, headers) from "slow" commands (Scalafix, which often requires compiling the code). But I'm not sure if "lint" fully captures that, since arguably Scalafix is also a form of linting.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - `tlCiStewardValidateConfig` (setting): The location of the Scala Steward config to validate (default: `.scala-steward.conf`, if exists). | ||
| - `tlCrossRootProject` (method): helper to create a `root` project that can aggregate both `Project`s and `CrossProject`s. Automatically creates separate jobs in the CI matrix for each platform (JVM, JS, etc.). | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me wonder if
tlCiHeaderCheckshould just be deprecated in favor of it being the default here. But probably notThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, wdym?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that instead of the current state we could have a default value of
tlCiLintCommands := List("headerCheckAll", "scalafmtAll"), and get rid oftlCiHeaderCheckas a key. If someone wants to opt out of header checks, they can modifytlCiLintCommands.