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.
173 lines
7.7 KiB
Plaintext
173 lines
7.7 KiB
Plaintext
use cicd/logging::manageLogs
|
|
use cicd/runners::CicdDispatchEngine
|
|
use cicd/runners::CicdRunnerEngine
|
|
use cicd/runners::setupRunner
|
|
use cicd/runners::stopRunner
|
|
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/steps::stepOn
|
|
use javascript::JavaScriptEngine
|
|
use log/logger::Logger
|
|
use process/command::|raw_commands
|
|
use process/environment::Environment
|
|
use process/environment::|environment
|
|
use std/data/string_map::|entry
|
|
use std/data/string_map::|map
|
|
use std/engine/util::startup
|
|
use std/flow::waitBlock
|
|
use std/ops/option::|wrap
|
|
use std/text/compose::|format
|
|
use work/resources::|container
|
|
use work/resources/arch::|amd64
|
|
|
|
treatment buildTestAya(const github_contexts: string = "{}")
|
|
model logger: Logger()
|
|
model dispatcher: CicdDispatchEngine(location="compose", api_token="")
|
|
model runner: CicdRunnerEngine()
|
|
model github_contexts: JavaScriptEngine()
|
|
{
|
|
startup()
|
|
prepareContexts[contexts=github_contexts](github_contexts=github_contexts)
|
|
manageLogs[logger=logger](output_directory="logs/")
|
|
setupRunner[logger=logger, dispatcher=dispatcher, runner=runner](
|
|
name="buildTestAya",
|
|
cpu=100,
|
|
memory=150,
|
|
storage=800,
|
|
containers=[
|
|
|container("aarch64", 6000, 1000, 8000, |amd64(), [], "rust:1.90-trixie", _)
|
|
]
|
|
)
|
|
|
|
buildTestAyaForArch[logger=logger, runner=runner, github_contexts=github_contexts](
|
|
short="aarch64",
|
|
arch="aarch64-unknown-linux-gnu",
|
|
repository_clone_ref="melodium_ci",
|
|
repository_clone_url="https://github.com/qvignaud/aya.git"
|
|
)
|
|
|
|
stopRunner[runner=runner]()
|
|
|
|
startup.trigger -> prepareContexts.trigger,ready -> setupRunner.trigger,ready -> buildTestAyaForArch.trigger,finished -> manageLogs.stop
|
|
buildTestAyaForArch.finished -> stopRunner.trigger
|
|
}
|
|
|
|
treatment buildTestAyaForArch[logger: Logger, runner: CicdRunnerEngine, github_contexts: JavaScriptEngine](short: string, arch: string, repository_clone_ref: string, repository_clone_url: string)
|
|
input trigger: Block<void>
|
|
output finished: Block<void>
|
|
{
|
|
prepare: stepOn[logger=logger, runner=runner](
|
|
name = "Prepare",//|format("prepare_{short}", |entry("short", short)),
|
|
executor_name = |wrap<string>(short),
|
|
commands = |raw_commands([
|
|
|format("rustup target add {arch}", |entry("arch", arch)),
|
|
"dpkg --add-architecture arm64",
|
|
"apt-get update",
|
|
"apt-get install -y liblzma-dev:arm64",
|
|
${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",
|
|
//${bash -c "curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/taiki-e/install-action/refs/heads/cargo-hack/main.sh | bash -"},
|
|
${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 -"},
|
|
"cat /tmp/github.env"
|
|
]),
|
|
environment = |wrap<Environment>(
|
|
|environment(
|
|
|map([
|
|
|entry("INPUT_TOOL", "cargo-hack"),
|
|
|entry("INPUT_TARGET", arch),
|
|
|entry("GITHUB_ENV", "/tmp/github.env")
|
|
]),
|
|
_, // working_directory
|
|
false, // expand_variables
|
|
false // clear_env
|
|
)
|
|
)
|
|
)
|
|
|
|
checkout: stepOn[logger=logger, runner=runner](
|
|
name = |format("checkout_{short}", |entry("short", short)),
|
|
executor_name = |wrap<string>(short),
|
|
commands = |raw_commands([
|
|
"git config --global url.https://.insteadOf git://",
|
|
|format("git clone --branch {repository_clone_ref} --depth 1 {repository_clone_url} /root/aya",
|
|
|map([
|
|
|entry("repository_clone_ref", repository_clone_ref),
|
|
|entry("repository_clone_url", repository_clone_url)
|
|
])
|
|
)
|
|
])
|
|
)
|
|
|
|
ready: waitBlock<void>()
|
|
|
|
build: stepOn[logger=logger, runner=runner](
|
|
name = |format("build_{short}", |entry("short", short)),
|
|
executor_name = |wrap<string>(short),
|
|
commands = |raw_commands([
|
|
// Build
|
|
${bash -c "set -o allexport && source /tmp/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
|
|
${bash -c "set -o allexport && source /tmp/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
|
|
${bash -c "set -o allexport && source /tmp/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"
|
|
}
|
|
]),
|
|
environment = |wrap<Environment>(
|
|
|environment(
|
|
|map([
|
|
|entry("RUST_BACKTRACE", "full"),
|
|
|entry("CARGO_BUILD_TARGET", arch)
|
|
]),
|
|
"/root/aya", // working_directory
|
|
false, // expand_variables
|
|
false // clear_env
|
|
)
|
|
)
|
|
)
|
|
|
|
Self.trigger -> prepare.trigger,completed --> ready.a,awaited -> build.trigger,finished -> Self.finished
|
|
Self.trigger -> checkout.trigger,completed -> ready.b
|
|
|
|
pendingState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |pending(), name = arch, description = "Build and Test Aya on arch", log_response = true)
|
|
successState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |success(), name = arch, description = "Build and Test Aya on arch", log_response = true)
|
|
errorState: postGithubStateContext[contexts=github_contexts, logger=logger](state = |error(), name = arch, description = "Build and Test Aya on arch", log_response = true)
|
|
|
|
Self.trigger -> pendingState.trigger
|
|
build.completed -> successState.trigger
|
|
build.failed -> errorState.trigger
|
|
}
|
|
|
|
/*
|
|
treatment buildTestAya()
|
|
{
|
|
|
|
}
|
|
|
|
treatment buildTestAyaForArch[logger: Logger](arch: string, short_arch: string)
|
|
trigger: Block<void>
|
|
{
|
|
build: localStep[logger=logger](
|
|
name = |format("build_{short_arch}", |entry("short_arch", short_arch)),
|
|
description = |format("Build tests for Aya on {arch}", |entry("arch", arch)),
|
|
commands = |raw_commands([
|
|
// Build
|
|
"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
|
|
"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
|
|
"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"
|
|
]),
|
|
variables = |wrap<StringMap>(|map([
|
|
|entry("RUST_BACKTRACE", "full"),
|
|
|entry("CARGO_BUILD_TARGET", arch)
|
|
]))
|
|
)
|
|
}*/ |