pull/1416/head
Quentin VIGNAUD 2 weeks ago
parent ace50a295d
commit f5901900cb

@ -0,0 +1,90 @@
use root/prepare::checkout
use root/prepare::setupToolchain
use root/prepare::prepareRust
treatment buildTestAyaForArch[logger: Logger, github_contexts: JavaScriptEngine, finish_concentrator: Concentrator](rust_target: string, repository_clone_url: string, repository_clone_ref: 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)
rustReady: waitBlock<void>()
projectReady: waitBlock<void>()
Self.trigger -> prepareRust.trigger,success ----> rustReady.a
Self.trigger -> setupToolchain.trigger,success -> rustReady.b,awaited -> projectReady.a
Self.trigger -> 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
"])
],
)
prepare.awaited -> build.trigger,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)
Self.trigger --> pendingState.trigger
run.success ---> successState.trigger
run.error -----> errorState.trigger
uncheckSuccess: uncheck<void>()
oneFailure: one<void>()
run.success -> uncheckSuccess.value,uncheck -> oneFailure.a
run.failed ----------------------------------> oneFailure.b,value -> failureState.trigger
}

@ -0,0 +1,77 @@
use cicd/naive::localStep
use log/logger::Logger
use process/command::|raw_commands
use std/data/string_map::StringMap
use std/data/string_map::|entry
use std/data/string_map::|map
use std/text/compose::|format
treatment checkout[logger: Logger](label: string, repository_clone_url: string, repository_clone_ref: string, clone_directory: string)
input trigger: Block<void>
output success: Block<void>
output finished: Block<void>
output error: Block<void>
{
localStep[logger=logger](
name = label,
commands = |raw_commands([
"git config --global url.https://.insteadOf git://",
|format("git clone --branch {repository_clone_ref} --depth 1 {repository_clone_url} {clone_directory}",
|map([
|entry("repository_clone_ref", repository_clone_ref),
|entry("repository_clone_url", repository_clone_url),
|entry("clone_directory", clone_directory)
])
)
])
)
Self.trigger -> localStep.trigger,success -> Self.success
localStep.finished --------> Self.finished
localStep.error -----------> Self.error
}
treatment setupToolchain[logger: Logger](rust_target: string)
input trigger: Block<void>
output success: Block<void>
output finished: Block<void>
output error: Block<void>
{
prepareSystem: localStep[logger=logger](
name = |format("setupToolchain ({rust_target})", |entry("rust_target", rust_target)),
commands = |raw_commands([
|format("mkdir /tmp/{rust_target}", |entry("rust_target", rust_target)),
|format("touch /tmp/{rust_target}/github.env", |entry("rust_target", rust_target)),
${bash -c "curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/taiki-e/setup-cross-toolchain-action/refs/tags/v1/main.sh | bash -"}/*,
|format("cat /tmp/{rust_target}/github.env", |entry("rust_target", rust_target))
]),
variables = |wrap<StringMap>(
|map([
|entry("INPUT_TARGET", rust_target),
|entry("GITHUB_ENV", |format("cat /tmp/{rust_target}/github.env", |entry("rust_target", short_rust_arch)))
])
)
)
Self.trigger -> prepareSystem.trigger,success -> Self.success
prepareSystem.finished --------> Self.finished
prepareSystem.error -----------> Self.error
}
treatment prepareRust[logger: Logger](rust_target: string)
input trigger: Block<void>
output success: Block<void>
output finished: Block<void>
output error: Block<void>
{
localStep[logger=logger](
name = |format("prepareRust ({arch})", |entry("arch", rust_target)),
commands = |raw_commands([
|format("rustup target add {arch}", |entry("arch", rust_target)),
${bash -c "curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash -"},
"cargo binstall cargo-hack"
])
)
Self.trigger -> localStep.trigger,success -> Self.success
localStep.finished --------> Self.finished
localStep.error -----------> Self.error
}
Loading…
Cancel
Save