louiscad
02/27/2022, 5:28 PMor
and and
functions/extensions, plus maybe other operators, and that would allow the library to keep track of which values are referenced, and automatically add the right needs
clauses.Piotr Krzemiński
02/27/2022, 5:57 PMlouiscad
02/27/2022, 5:59 PMlouiscad
02/27/2022, 5:59 PMlouiscad
02/27/2022, 6:00 PMlouiscad
02/27/2022, 6:00 PMlouiscad
02/27/2022, 6:01 PMNikky
02/27/2022, 6:18 PMneeds
of jobs it depends on too (if that not happeneing already) to make sure github executes things in strictly the correct orderlouiscad
02/27/2022, 6:19 PMwhy does windows-checking depend on linux-upload and such?Because it builds with stuff published from Linux as well.
louiscad
02/27/2022, 6:21 PMNikky
02/27/2022, 6:24 PMlinux-upload needs create-staging-repository
, linux-checking needs linux-upload
and `finalize`needs linux-checking
(and the other platforms, but don't want to type so much)
the dsl could make the dependencies a exhaustive list of eg. create-staging-repository, windows-checking, macos-checking, linux-checking
for the finalize
stepNikky
02/27/2022, 6:25 PMNikky
02/27/2022, 6:29 PMlouiscad
02/27/2022, 6:30 PMcallsInPlace(ExactlyOnce)
, you can solve thatNikky
02/27/2022, 6:30 PMlouiscad
02/27/2022, 6:33 PMval someJob: GitHubActionsJob
workflow {
someJob = job(name = "whatever") {
// Whatever
}
job(name = "something else") {
someJob.whatever()
whatever(someJob.output["something?"])
}
}
louiscad
02/27/2022, 6:33 PMworkflow
function has the right callsInPlace
contract.Nikky
02/27/2022, 6:41 PMval someJob = object : Job("someJob") {
val someStep by step()
}
val nextJob = object : Job("NextJob") {
val nextStep by step(
env = linkedMapOf(
"value" to expr(
needs[someJob].steps[someJob.someStep].outputs.get["something"]
)
)
)
}
would be nice if we can refer to steps in other jobs by name somehow.. but ... no clue how to make kotlin expose variables in other objects or scopesNikky
02/27/2022, 6:57 PMneeds
that as a side effect adds the dependency to the job they are attached to
but it looks terrible:
val workFlow = workflow(
name = "Docker build & push",
on = listOf(
Push(branches = listOf("main")),
PullRequest(branches = listOf("main"))
),
sourceFile = Paths.get(".github/workflows/workflow.main.kts"),
targetFile = Paths.get(".github/workflows/workflow.yml"),
) {
val someJob = job(name = "someJob", runsOn = UbuntuLatest)
val someStep = someJob.step(
name = "someStep",
action = SomeAction()
)
val nextJob = job(name = "nextJob", runsOn = UbuntuLatest)
val nextStep = nextJob.uses(
name = "nextStep",
action = NextAction()
) { // this: UseBuilder ->
env = mapOf(
"arg" to expr(steps[someStep].outputs.get["someOutput"])
)
}
}
writeWorkflows(
addConsistencyCheck = true,
workflows = listOf(
workflow
),
args
)
.. unless ofc there is also cross workflow interactions that we need to model..
could be improved by using delegates maybe `val some job name
by job() {}`Nikky
02/27/2022, 7:02 PM