mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
8.4 KiB
Plaintext
183 lines
8.4 KiB
Plaintext
use cicd/logging::manageLogs
|
|
use cicd/naive::localStep
|
|
use cicd/services/github::prepareContexts
|
|
use cicd/services/github::postGithubStateContext
|
|
use cicd/services/github::|pending
|
|
use cicd/services/github::|success
|
|
use cicd/services/github::|error
|
|
use cicd/services/github::|failure
|
|
use javascript::JavaScriptEngine
|
|
use log/logger::Logger
|
|
use process/command::|command
|
|
use root/prepare::checkout
|
|
use root/prepare::setupToolchain
|
|
use root/prepare::prepareRust
|
|
use std/data/string_map::StringMap
|
|
use std/data/string_map::|entry
|
|
use std/data/string_map::|map
|
|
use std/engine/util::startup
|
|
use std/flow::one
|
|
use std/flow::passBlock
|
|
use std/flow::uncheck
|
|
use std/flow::waitBlock
|
|
use std/flow::trigger
|
|
use std/flow/concentrate::Concentrator
|
|
use std/flow/concentrate::concentrateBlock
|
|
use std/flow/concentrate::concentrated
|
|
use std/ops/option::|wrap
|
|
use std/ops/vec::|contains
|
|
use std/text/compose::|format
|
|
|
|
treatment buildTestAyaForArch[logger: Logger, github_contexts: JavaScriptEngine, finish_concentrator: Concentrator](rust_target: string, repository_clone_url: string, repository_clone_ref: string, targets: Vec<string>)
|
|
input trigger: Block<void>
|
|
output finished: Block<void>
|
|
{
|
|
concentrateFinish: concentrateBlock<void>[concentrator=finish_concentrator]()
|
|
run.finished -> concentrateFinish.data
|
|
|
|
checkout[logger=logger](
|
|
label=|format("checkout ({rust_target})", |entry("rust_target", rust_target)),
|
|
repository_clone_url=repository_clone_url,
|
|
repository_clone_ref=repository_clone_ref,
|
|
clone_directory=|format("/tmp/work_{rust_target}", |entry("rust_target", rust_target))
|
|
)
|
|
setupToolchain[logger=logger](rust_target=rust_target)
|
|
prepareRust[logger=logger](rust_target=rust_target)
|
|
|
|
doRun: passBlock<void>(cond=|contains<string>(targets, rust_target))
|
|
rustReady: waitBlock<void>()
|
|
projectReady: waitBlock<void>()
|
|
Self.trigger -> doRun.block,passed -> prepareRust.trigger,success ----> rustReady.a
|
|
doRun.passed -------> setupToolchain.trigger,success -> rustReady.b,awaited -> projectReady.a
|
|
doRun.passed -------> checkout.trigger,success ------------------------------> projectReady.b,awaited -> run.trigger
|
|
|
|
run: localStep[logger=logger](
|
|
name = |format("run ({rust_target})", |entry("rust_target", rust_target)),
|
|
variables = |wrap<StringMap>(
|
|
|map([
|
|
|entry("RUST_BACKTRACE", "full"),
|
|
|entry("CARGO_BUILD_TARGET", rust_target)
|
|
])
|
|
),
|
|
commands = [
|
|
// Build
|
|
|command("bash", ["-c", "
|
|
set -o allexport && source /tmp/${CARGO_BUILD_TARGET}/github.env && set +o allexport
|
|
cargo hack build --all-targets --feature-powerset \\
|
|
--exclude aya-ebpf \\
|
|
--exclude aya-ebpf-bindings \\
|
|
--exclude aya-log-ebpf \\
|
|
--exclude integration-ebpf \\
|
|
--exclude xtask \\
|
|
--workspace
|
|
"]),
|
|
// Test
|
|
|command("bash", ["-c", "
|
|
set -o allexport && source /tmp/${CARGO_BUILD_TARGET}/github.env && set +o allexport
|
|
cargo hack test --all-targets --feature-powerset \\
|
|
--exclude aya-ebpf \\
|
|
--exclude aya-ebpf-bindings \\
|
|
--exclude aya-log-ebpf \\
|
|
--exclude integration-ebpf \\
|
|
--exclude integration-test \\
|
|
--exclude xtask \\
|
|
--workspace
|
|
"]),
|
|
// Doc
|
|
|command("bash", ["-c", "
|
|
set -o allexport && source /tmp/${CARGO_BUILD_TARGET}/github.env && set +o allexport
|
|
cargo hack test --doc --feature-powerset \\
|
|
--exclude aya-ebpf \\
|
|
--exclude aya-ebpf-bindings \\
|
|
--exclude aya-log-ebpf \\
|
|
--exclude integration-ebpf \\
|
|
--exclude integration-test \\
|
|
--exclude xtask \\
|
|
--workspace
|
|
"])
|
|
]
|
|
)
|
|
|
|
run.finished -> Self.finished
|
|
|
|
pendingState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |pending(), name = rust_target, description = "Build and Test Aya on arch", log_response = true)
|
|
successState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |success(), name = rust_target, description = "Build and Test Aya on arch", log_response = true)
|
|
errorState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |error(), name = rust_target, description = "Build and Test Aya on arch", log_response = true)
|
|
failureState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |failure(), name = rust_target, description = "Build and Test Aya on arch", log_response = true)
|
|
|
|
doRun.passed --> pendingState.trigger
|
|
run.success ---> successState.trigger
|
|
run.error -----> errorState.trigger
|
|
|
|
uncheckSuccess: uncheck<void>()
|
|
oneFailure: one<void>()
|
|
realFailure: waitBlock<void>()
|
|
run.success -> uncheckSuccess.value,uncheck -> oneFailure.a
|
|
run.failed ----------------------------------> oneFailure.b,value -> realFailure.a,awaited -> failureState.trigger
|
|
doRun.passed ------------------------------------------------------> realFailure.b
|
|
}
|
|
|
|
treatment buildTestAya(const github_contexts: string = "{}", targets: Vec<string>, repository_clone_url: string, repository_clone_ref: string)
|
|
model logger: Logger()
|
|
model finish_concentrator: Concentrator()
|
|
model github_contexts: JavaScriptEngine()
|
|
{
|
|
startup()
|
|
prepareContexts[contexts=github_contexts](github_contexts=github_contexts)
|
|
manageLogs[logger=logger](output_directory="logs/")
|
|
concentratedFinish: concentrated<void>[concentrator=finish_concentrator]()
|
|
triggerFinish: trigger<void>()
|
|
startup.trigger -> prepareContexts.trigger,ready -> concentratedFinish.trigger,data -> triggerFinish.stream,end -> manageLogs.stop
|
|
|
|
build_aarch64: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="aarch64-unknown-linux-gnu",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
build_armv7: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="armv7-unknown-linux-gnueabi",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
build_loongarch64: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="loongarch64-unknown-linux-gnu",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
build_powerpc64le: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="powerpc64le-unknown-linux-gnu",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
build_riscv64gc: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="riscv64gc-unknown-linux-gnu",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
build_s390x: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="s390x-unknown-linux-gnu",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
build_x86_64: buildTestAyaForArch[logger=logger, github_contexts=github_contexts, finish_concentrator=finish_concentrator](
|
|
targets=targets,
|
|
rust_target="x86_64-unknown-linux-gnu",
|
|
repository_clone_ref=repository_clone_ref,
|
|
repository_clone_url=repository_clone_url
|
|
)
|
|
|
|
prepareContexts.ready -> build_aarch64.trigger
|
|
prepareContexts.ready -> build_armv7.trigger
|
|
prepareContexts.ready -> build_loongarch64.trigger
|
|
prepareContexts.ready -> build_powerpc64le.trigger
|
|
prepareContexts.ready -> build_riscv64gc.trigger
|
|
prepareContexts.ready -> build_s390x.trigger
|
|
prepareContexts.ready -> build_x86_64.trigger
|
|
}
|