Skip to content
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
4 changes: 2 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ maxColumn = 120
align.preset = more
rewrite.trailingCommas.style = multiple
rewrite.scala3.removeOptionalBraces = yes
rewrite.scala3.insertEndMarkerMinLines = 10
rewrite.scala3.removeEndMarkerMaxLines = 5
rewrite.scala3.endMarker.insert.blankGaps.min = 1
rewrite.scala3.endMarker.remove.blankGaps.max = 0
rewrite.scala3.convertToNewSyntax = yes
3 changes: 0 additions & 3 deletions docs/src/test/scala/zipx/docs/BuildSite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ sbt zipxWorkflowGenerate""",
)
),
)
end site

override def layers: ZLayer[Any, Nothing, SiteBuilder] =
EarlyEffectTheme.layers
Expand Down Expand Up @@ -162,8 +161,6 @@ sbt zipxWorkflowGenerate""",
.findFirst()
if found.isPresent then Some(found.get.nn) else None
finally stream.close()
end if
end walkTargetOut

private def repoRoot: Path =
Iterator
Expand Down
1 change: 0 additions & 1 deletion docs/src/test/scala/zipx/docs/DocDiff.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ object DocDiff:
val kids: Seq[Arg[Any]] =
(prefix ++ body.toList).map(ui => Arg.ChildArg(ui))
E.div(Styles.Panel, kids)
end panel

/** Several file hunks as one pull request. */
def stack(panels: UI[Any]*): UI[Any] =
Expand Down
1 change: 0 additions & 1 deletion modules/agent/src/main/scala/zipx/agent/AgentDaemon.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ object AgentDaemon:
iptables <- one(pins, Feed, IptablesId).flatMap(validateApt)
suite <- one(pins, Feed, SuiteId).flatMap(validateSuite)
yield DaemonPins(cli, fuse, iptables, suite)
end resolve

def versions(body: String, packageName: String): List[String] =
body.split("\n\n", -1).toList.flatMap { stanza =>
Expand Down
1 change: 0 additions & 1 deletion modules/agent/src/main/scala/zipx/agent/AgentFeeds.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ object AgentFeeds:
val wantDaemon = sbtImage && (docker || pins.exists(_.feed == AgentDaemon.Feed))
if !wantDaemon || ubuntu.exists(_.name == AgentDaemon.Feed) then ubuntu
else ubuntu :+ AgentDaemon.feed(pins)
end withUser

val base: PinFeed = PinFeed(
name = AgentPins.BaseFeed,
Expand Down
1 change: 0 additions & 1 deletion modules/agent/src/main/scala/zipx/agent/AgentPins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ object AgentPins:
docker <- one(pins, DockerFeed, DockerId).flatMap(validateDocker)
runner <- one(pins, SbtFeed, SbtId).flatMap(validateRunner)
yield AgentPins(base, docker, runner)
end resolve

private def one(pins: Seq[Pin], feed: PinFeedName, id: String): Either[String, String] =
pins.collectFirst { case pin if pin.feed == feed && pin.id == id => pin.current } match
Expand Down
3 changes: 0 additions & 3 deletions modules/agent/src/main/scala/zipx/agent/CursorEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ object CursorEnv:
case None => Some(""" "start": "sudo service docker start"""")
val fields = (image.toList ++ build.toList) ++ List(s""" "install": "bash $InstallRel"""") ++ start.toList
"{\n" + fields.mkString(",\n") + "\n}\n"
end environmentJson

def dockerfile(env: AgentEnv): Either[String, Option[String]] =
env.toolchain match
Expand Down Expand Up @@ -120,7 +119,6 @@ object CursorEnv:
|USER ubuntu
|WORKDIR /home/ubuntu
|""".stripMargin
end ubuntuDockerfile

private def sbtDockerfile(image: AgentImage, docker: Boolean): Either[String, Option[String]] =
if !docker then
Expand Down Expand Up @@ -220,7 +218,6 @@ object CursorEnv:
| > /usr/local/bin/zipx-dockerd; \\
| chmod 0755 /usr/local/bin/zipx-dockerd
|""".stripMargin
end daemonRun

private def dockerSetup(version: String): String =
s"""RUN set -eux; \\
Expand Down
2 changes: 0 additions & 2 deletions modules/agent/src/main/scala/zipx/agent/DebianVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ object DebianVersion:
if dig != 0 then dig
else if lNext >= left.length && rNext >= right.length then 0
else compareAt(left, right, lNext, rNext)
end compareAt

/** Non-digit run. `~` sorts before the end of the part. Letters sort before other characters. */
private def nonDigits(left: String, right: String, li: Int, ri: Int): (Int, Int, Int) =
Expand All @@ -51,7 +50,6 @@ object DebianVersion:
val cmp = Integer.compare(weight(lc), weight(rc))
if cmp != 0 then (li, ri, cmp)
else nonDigits(left, right, li + step(lc), ri + step(rc))
end nonDigits

private def digits(raw: String, from: Int): (String, Int) =
def end(i: Int): Int =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ object SbtImageFeeds:
case Some(more) => go(more.group(1), left - 1, seen + url, acc ++ names)
}
go(s"$Tags" + s"eclipse-temurin-$major", 10, Set.empty, Nil)
end tagNames

private def manifestDigest(tag: String): Either[String, String] =
for
Expand Down
1 change: 0 additions & 1 deletion modules/agent/src/main/scala/zipx/agent/ZipxAgentEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ object ZipxAgentEnv:
else Left(s"zipx: secret-backed env name '$name' is not a shell identifier")
}
}
end secretNames
end ZipxAgentEnv
2 changes: 0 additions & 2 deletions modules/aws/src/main/scala/zipx/aws/ZipxAws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ object ZipxAws:
extraSteps = ecrLoginSteps,
condition = condition,
)
end dockerPublish

/** [[dockerPublish]] over several registries in one job. One build is pushed, so the registries hold identical bytes.
* Build `dockerAliases` with [[EcrImage.taggedAll]] from the same [[EcrRegistry]] values so the two sides cannot
Expand All @@ -152,6 +151,5 @@ object ZipxAws:
condition = condition,
)
.withSharedTargets(registryTargets(registries))
end dockerPublishAll

end ZipxAws
1 change: 1 addition & 0 deletions modules/aws/src/main/scala/zipx/aws/ecr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ final case class EcrRegistry(accountId: AwsAccountId, region: AwsRegion):
def host: String = s"$accountId.dkr.ecr.$region.amazonaws.com"

def image(repository: EcrRepository): EcrImage = EcrImage(this, repository)
end EcrRegistry

final case class EcrImage(registry: EcrRegistry, repository: EcrRepository):

Expand Down
1 change: 0 additions & 1 deletion modules/aws/src/test/scala/zipx/aws/ZipxAwsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,5 @@ object ZipxAwsSpec extends ZIOSpecDefault:
(TargetName("dev"), EcrRegistry(AwsAccountId("555566667777"), AwsRegion("us-east-2")), secret"DEV_ROLE"),
(TargetName("mirror"), EcrRegistry(AwsAccountId("888899990000"), AwsRegion("eu-central-1")), secret"MIRROR_ROLE"),
)
end sixRegistries

end ZipxAwsSpec
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ object ZipxGitHubPackages:
condition = condition,
extraEnv = extras,
)
end sharedRegistry

private def publishCap(
name: CapabilityName,
Expand Down Expand Up @@ -95,6 +94,5 @@ object ZipxGitHubPackages:
) ++ extraEnv,
condition = condition,
)
end publishCap

end ZipxGitHubPackages
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ object ZipxDocs:
workflowCall = Some(WorkflowCall(uses = ReusableWorkflow, withInputs = inputs)),
condition = Some(deployWhen),
)
end pages

end ZipxDocs
1 change: 0 additions & 1 deletion modules/cli/src/main/scala/zipx/cli/Args.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ object Args:
case "--file" :: Nil => Left("zipx: --file needs a path")
case unknown :: _ => Left(s"zipx: unknown flag '$unknown'.\n$usage")
loop(args, Flags(yes = false, dryRun = false, verifyLoad = false, file = DefaultFile))
end flags

val usage: String =
"""usage:
Expand Down
3 changes: 0 additions & 3 deletions modules/cli/src/main/scala/zipx/cli/CatalogOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ object CatalogOps:
rendered = ZipxCatalog.renderPlugins(merged)
props = after.sbt.map(ZipxCatalog.renderBuildProperties)
yield UpdatePlan(deps, acts, holds ++ updates.held.map(_.message), next2, rendered, props)
end for
end planUpdate

private def crossingOf(parsed: CatalogConstructors): Either[String, CatalogCrossing] =
(parsed.scala, parsed.sbt) match
Expand Down Expand Up @@ -76,7 +74,6 @@ object CatalogOps:
expected = ZipxCatalog.mergePlugins(parsed.plugins, plugins)
_ <- ZipxCatalog.checkPlugins(path.toString, Right(got), expected)
yield ()
end check

def formatPlan(plan: UpdatePlan): String =
val deps = ZipxCatalog.formatBumps(plan.depBumps)
Expand Down
2 changes: 0 additions & 2 deletions modules/cli/src/main/scala/zipx/cli/LoadVerify.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ object LoadVerify:
snap.props match
case Some(body) => write(props, body)
case None => Files.deleteIfExists(props)
end restore

def probe(root: Path, run: Path => Either[String, Unit] = defaultProbe): Either[String, Unit] =
run(root)
Expand All @@ -47,7 +46,6 @@ object LoadVerify:
restore(versionsFile, snap)
Right(Some(err))
}
end applyWrite

private def defaultProbe(root: Path): Either[String, Unit] =
try
Expand Down
1 change: 1 addition & 0 deletions modules/core/src/main/scala/zipx/ZipxVersions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ object CatalogContents:
final case class Rows(coords: Seq[ZipxCoord], pins: Seq[Pin], actions: Seq[Action], ships: Seq[PublishedRow])

inline given CatalogContents = ${ zipx.core.ZipxCatalog.contentsImpl }
end CatalogContents

/** No sbt types, so the CLI compiles a catalog without the target build. Catalogs extend the plugin's `ZipxVersions`.
*/
Expand Down
2 changes: 0 additions & 2 deletions modules/core/src/main/scala/zipx/core/ActionPinFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ object ActionPinFile:
case Right(_) if !namesAction(ref, field) =>
refuse(s"pin '$key' must name ${field.prefix}, but this ref is '$ref'")
case Right(actionRef) => Right(Entry.FieldPin(field, actionRef, Option(ver).filter(_.nonEmpty)))
end fieldPin

if isIgnorable(line) then Right(Entry.Nothing)
else
Expand All @@ -97,7 +96,6 @@ object ActionPinFile:
refuse(s"indented, but no '${ActionPins.ExtraPrefix}:' block is open above it")
case _ =>
refuse("not a pin, a # comment, or a blank line; expected 'key: owner/action@ref # vX.Y.Z'")
end if
end parseLine

private final case class Parsed(
Expand Down
1 change: 0 additions & 1 deletion modules/core/src/main/scala/zipx/core/ActionPins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ object ActionPins:
rows.foldLeft[Either[String, ActionPins]](Right(base)) { (accE, action) =>
accE.flatMap(pins => overlayOne(pins, action))
}
end overlay

private def overlayOne(pins: ActionPins, action: Action): Either[String, ActionPins] =
action.toRef.flatMap { ref =>
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/zipx/core/Advisory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enum AdvisorySeverity:
case Low, Moderate, High, Critical

def rank: Int = ordinal
end AdvisorySeverity

object AdvisorySeverity:
def parse(raw: String): AdvisorySeverity =
Expand Down Expand Up @@ -37,7 +38,6 @@ final class OsvAdvisorySource(
case Left(err) => Left(s"osv: $err")
case Right(res) if res.status == 200 => OsvAdvisorySource.parseResponse(res.body)
case Right(res) => Left(s"osv: HTTP ${res.status}")
end advisories
end OsvAdvisorySource

object OsvAdvisorySource:
Expand Down
1 change: 0 additions & 1 deletion modules/core/src/main/scala/zipx/core/AdvisoryCheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ object AdvisoryCheck:
githubPurl(name, ver).map(p => (name, ver, p))
}
fields ++ extras
end actionQueries

def findingMessage(
kind: String,
Expand Down
2 changes: 0 additions & 2 deletions modules/core/src/main/scala/zipx/core/Affected.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ object Affected:
val readSeeds = readFiles.map(byPath)
if others.exists(isBuildFile) || readSeeds.exists(_.isEmpty) then graph.ids.toSet
else graph.affectedClosure(readSeeds.flatten.flatten.toSet ++ others.flatMap(owningModules(graph, _)))
end affectedModules

/** `None` means the diff failed (bad base ref, no git), which fails open to [[AllSentinel]]: an empty list would skip
* every Verify job and report green untested. `Some(Nil)` is a successful empty diff and stays empty.
Expand All @@ -54,7 +53,6 @@ object Affected:
else
val best = ranked.map(_._2).max
ranked.collect { case (id, len) if len == best => id }.toSet
end owningModules

private def underBase(path: String, base: String): Boolean =
val normalized = if base.endsWith("/") then base.dropRight(1) else base
Expand Down
1 change: 0 additions & 1 deletion modules/core/src/main/scala/zipx/core/Capability.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ object TargetGroup extends Subtype[String]:
else
s"invalid target group '$input': it is a dispatch choice beside target names, so it must start with an ASCII " +
"letter or _ and contain only ASCII letters, digits, - or _"
end TargetGroup

/** What a capability's `extraSteps` / `postSteps` see. `target` is populated only when the capability fans out
* job-per-target.
Expand Down
2 changes: 0 additions & 2 deletions modules/core/src/main/scala/zipx/core/CatalogAuthority.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,4 @@ object CatalogConflict:
s"Update the catalog: sbt zipxDepUpdate, or pin ${wanted.render}"
case _ =>
s"Pin ${wanted.render} in the catalog."
end match
end fix
end CatalogConflict
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ object PublishedNames:
ScalaPlatform.values.toList.map(p => s"${lib.artifact}_${p.infix}${crossing.scalaBinary}")
case Cross.Full => ScalaPlatform.values.toList.map(p => s"${lib.artifact}_${p.infix}${crossing.scala}")
case plugin: Plugin => List(s"${plugin.artifact}_sbt${crossing.sbtBinary}_${crossing.scalaBinary}")
end PublishedNames

final case class CatalogUpdates(bumps: List[DepBump], held: List[FamilyHold])

Expand Down
2 changes: 0 additions & 2 deletions modules/core/src/main/scala/zipx/core/CompanionPr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ object CompanionPr:
),
trailingNewline = true,
)
end open

/** The heredoc is unquoted so `GITHUB_RUN_ID` expands. No backticks: they would run as command substitution. */
private inline def workflowRegenLines(inline prefix: String): List[ScriptLine] =
Expand All @@ -116,7 +115,6 @@ object CompanionPr:
ScriptLine.empty,
ScriptLine("The PR branch is " + prefix + "-${GITHUB_RUN_ID}."),
)
end workflowRegenLines

private inline def runBranch(inline prefix: String): Word.Dquote =
Word.dquote(Word.lit(prefix + "-"), Word.vBraced("GITHUB_RUN_ID"))
Expand Down
3 changes: 2 additions & 1 deletion modules/core/src/main/scala/zipx/core/CoverageWorkflow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ enum CoverageTrigger:

/** A PR carrying `label`: when that label is added, and on each push or reopen while it stays. */
case PrLabel(label: ExprLiteral)
end CoverageTrigger

object CoverageTrigger:

inline def prLabel(inline label: String): CoverageTrigger = PrLabel(ExprLiteral(label.trim))

def prLabelMake(label: String): Either[String, CoverageTrigger] = ExprLiteral.make(label.trim).map(PrLabel(_))
end CoverageTrigger

/** scoverage in `zipx-coverage.yml`, so `ci.yml`'s required checks never compile instrumented classes.
*
Expand Down Expand Up @@ -77,7 +79,6 @@ object CoverageWorkflow:
config.actions.checkout,
config.runnerOs,
)
end plan

def render(coverage: CoverageWorkflow, config: PlanConfig): Either[String, String] =
Render.render(plan(coverage, config)).map(ActionPinFile.annotateUses(_, config.actions))
Expand Down
4 changes: 0 additions & 4 deletions modules/core/src/main/scala/zipx/core/DepCleanup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ final case class DepCleanupReport(
s" ${a.selected.valName} (${a.selected.group}:${a.selected.artifact}; family ${a.familyArtifact} ${a.familyRevision})"
)
(List(header) ++ drop ++ align).mkString("\n")
end if
end render
end DepCleanupReport

object DepCleanup:
Expand All @@ -76,7 +74,6 @@ object DepCleanup:
if seen.add(dep) then q.enqueue(dep)
}
seen.toSet
end closure

val tentative = selected.filter { s =>
closure(selected.filterNot(o => k(o) == k(s))).contains(k(s))
Expand Down Expand Up @@ -123,5 +120,4 @@ object DepCleanup:
)
}
.flatten
end familyCandidate
end DepCleanup
1 change: 1 addition & 0 deletions modules/core/src/main/scala/zipx/core/DeployPlan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ final case class DeployPlan(sha: GitSha, images: List[ModuleId], targets: ListMa
val nonEmpty: Map[String, List[String]] =
ListMap.from(targets.collect { case (t, ms) if ms.nonEmpty => (t: String) -> ms.map(id => id: String) })
nonEmpty.toJson
end DeployPlan

object DeployPlan:

Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/main/scala/zipx/core/DeployRequest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum DeploySelection:

/** Nothing, for a reason the resolve job logs. Not a failure: a `no-deploy` merge is supposed to deploy nothing. */
case Skip(reason: String)
end DeploySelection

object DeployRequest:

Expand Down Expand Up @@ -87,8 +88,6 @@ object DeployRequest:
)
case (DeployTrigger.Manual(_), _) =>
Left("zipx: DeployTrigger.Manual deploys only from a dispatch; a push or PR event never runs zipx-deploy.yml")
end match
end select

/** The PR's labels, as the resolve job receives them from `toJSON(github.event.pull_request.labels.*.name)`. */
def labelsFromJson(json: String): Either[String, Set[String]] =
Expand Down
Loading
Loading