From 62037bb0e9cd05f46c1d15fcffc5edd98e2c2749 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Fri, 2 Aug 2024 10:40:33 -0500 Subject: [PATCH 1/2] Add `with*` methods for WorkflowJob --- .../org/typelevel/sbt/gha/WorkflowJob.scala | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala index 5e1f9c5f..8fa63253 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowJob.scala @@ -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 { @@ -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" } } From 0319799a2dcc9690ac46ef98da07a32e444c6ec7 Mon Sep 17 00:00:00 2001 From: Darren Gibson Date: Sat, 3 Aug 2024 08:24:34 -0500 Subject: [PATCH 2/2] Add mima overrides for new with* methods on WorkflowJob --- github-actions/mima.sbt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 github-actions/mima.sbt diff --git a/github-actions/mima.sbt b/github-actions/mima.sbt new file mode 100644 index 00000000..745a7a23 --- /dev/null +++ b/github-actions/mima.sbt @@ -0,0 +1,23 @@ +import com.typesafe.tools.mima.core._ +mimaBinaryIssueFilters ++= Seq( + "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](_))