Skip to content
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

Add with* methods for WorkflowJob #728

Merged
merged 2 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions github-actions/mima.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import com.typesafe.tools.mima.core._
mimaBinaryIssueFilters ++= Seq(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think MiMa might support wildcards, but this is good too.

ProblemFilters.exclude[ReversedMissingMethodProblem](
  "org.typelevel.sbt.gha.WorkflowJob.with*"
)

"org.typelevel.sbt.gha.WorkflowJob.withId",
"org.typelevel.sbt.gha.WorkflowJob.withName",
"org.typelevel.sbt.gha.WorkflowJob.withSteps",
"org.typelevel.sbt.gha.WorkflowJob.withSbtStepPreamble",
"org.typelevel.sbt.gha.WorkflowJob.withCond",
"org.typelevel.sbt.gha.WorkflowJob.withPermissions",
"org.typelevel.sbt.gha.WorkflowJob.withEnv",
"org.typelevel.sbt.gha.WorkflowJob.withOses",
"org.typelevel.sbt.gha.WorkflowJob.withScalas",
"org.typelevel.sbt.gha.WorkflowJob.withJavas",
"org.typelevel.sbt.gha.WorkflowJob.withNeeds",
"org.typelevel.sbt.gha.WorkflowJob.withMatrixFailFast",
"org.typelevel.sbt.gha.WorkflowJob.withMatrixAdds",
"org.typelevel.sbt.gha.WorkflowJob.withMatrixIncs",
"org.typelevel.sbt.gha.WorkflowJob.withMatrixExcs",
"org.typelevel.sbt.gha.WorkflowJob.withRunsOnExtraLabels",
"org.typelevel.sbt.gha.WorkflowJob.withContainer",
"org.typelevel.sbt.gha.WorkflowJob.withEnvironment",
"org.typelevel.sbt.gha.WorkflowJob.withConcurrency",
"org.typelevel.sbt.gha.WorkflowJob.withTimeoutMinutes"
).map(ProblemFilters.exclude[ReversedMissingMethodProblem](_))
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ sealed abstract class WorkflowJob {
def environment: Option[JobEnvironment]
def concurrency: Option[Concurrency]
def timeoutMinutes: Option[Int]

def withId(id: String): WorkflowJob
def withName(name: String): WorkflowJob
def withSteps(steps: List[WorkflowStep]): WorkflowJob
def withSbtStepPreamble(sbtStepPreamble: List[String]): WorkflowJob
def withCond(cond: Option[String]): WorkflowJob
def withPermissions(permissions: Option[Permissions]): WorkflowJob
def withEnv(env: Map[String, String]): WorkflowJob
def withOses(oses: List[String]): WorkflowJob
def withScalas(scalas: List[String]): WorkflowJob
def withJavas(javas: List[JavaSpec]): WorkflowJob
def withNeeds(needs: List[String]): WorkflowJob
def withMatrixFailFast(matrixFailFast: Option[Boolean]): WorkflowJob
def withMatrixAdds(matrixAdds: Map[String, List[String]]): WorkflowJob
def withMatrixIncs(matrixIncs: List[MatrixInclude]): WorkflowJob
def withMatrixExcs(matrixExcs: List[MatrixExclude]): WorkflowJob
def withRunsOnExtraLabels(runsOnExtraLabels: List[String]): WorkflowJob
def withContainer(container: Option[JobContainer]): WorkflowJob
def withEnvironment(environment: Option[JobEnvironment]): WorkflowJob
def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob
def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob
}

object WorkflowJob {
Expand Down Expand Up @@ -106,6 +127,30 @@ object WorkflowJob {
concurrency: Option[Concurrency],
timeoutMinutes: Option[Int])
extends WorkflowJob {

// scalafmt: { maxColumn = 200 }
override def withId(id: String): WorkflowJob = copy(id = id)
override def withName(name: String): WorkflowJob = copy(name = name)
override def withSteps(steps: List[WorkflowStep]): WorkflowJob = copy(steps = steps)
override def withSbtStepPreamble(sbtStepPreamble: List[String]): WorkflowJob = copy(sbtStepPreamble = sbtStepPreamble)
override def withCond(cond: Option[String]): WorkflowJob = copy(cond = cond)
override def withPermissions(permissions: Option[Permissions]): WorkflowJob = copy(permissions = permissions)
override def withEnv(env: Map[String, String]): WorkflowJob = copy(env = env)
override def withOses(oses: List[String]): WorkflowJob = copy(oses = oses)
override def withScalas(scalas: List[String]): WorkflowJob = copy(scalas = scalas)
override def withJavas(javas: List[JavaSpec]): WorkflowJob = copy(javas = javas)
override def withNeeds(needs: List[String]): WorkflowJob = copy(needs = needs)
override def withMatrixFailFast(matrixFailFast: Option[Boolean]): WorkflowJob = copy(matrixFailFast = matrixFailFast)
override def withMatrixAdds(matrixAdds: Map[String, List[String]]): WorkflowJob = copy(matrixAdds = matrixAdds)
override def withMatrixIncs(matrixIncs: List[MatrixInclude]): WorkflowJob = copy(matrixIncs = matrixIncs)
override def withMatrixExcs(matrixExcs: List[MatrixExclude]): WorkflowJob = copy(matrixExcs = matrixExcs)
override def withRunsOnExtraLabels(runsOnExtraLabels: List[String]): WorkflowJob = copy(runsOnExtraLabels = runsOnExtraLabels)
override def withContainer(container: Option[JobContainer]): WorkflowJob = copy(container = container)
override def withEnvironment(environment: Option[JobEnvironment]): WorkflowJob = copy(environment = environment)
override def withConcurrency(concurrency: Option[Concurrency]): WorkflowJob = copy(concurrency = concurrency)
override def withTimeoutMinutes(timeoutMinutes: Option[Int]): WorkflowJob = copy(timeoutMinutes = timeoutMinutes)
// scalafmt: { maxColumn = 96 }

override def productPrefix = "WorkflowJob"
}
}
Loading