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.
175 lines
5.2 KiB
Plaintext
175 lines
5.2 KiB
Plaintext
use cicd/services/github::replicateContextsWithInputs
|
|
use cicd/services/github::runAction
|
|
use javascript::JavaScriptEngine
|
|
use log/logger::Logger
|
|
use std/data/string_map::StringMap
|
|
use std/data/string_map::|entry
|
|
use std/data/string_map::|map
|
|
use std/ops/option::|wrap
|
|
|
|
#[generated(true)]
|
|
#[github_action(Swatinem/rust-cache@v2)]
|
|
treatment rustCache[contexts: JavaScriptEngine, logger: Logger](
|
|
var cache_all_crates: string = "false",
|
|
var cache_bin: string = "true",
|
|
var cache_directories: string = "",
|
|
var cache_on_failure: string = "",
|
|
var cache_provider: string = "github",
|
|
var cache_targets: string = "true",
|
|
var cache_workspace_crates: string = "false",
|
|
var env_vars: string = "",
|
|
var key: string = "",
|
|
var lookup_only: string = "false",
|
|
var prefix_key: string = "v0-rust",
|
|
var save_if: string = "true",
|
|
var shared_key: string = "",
|
|
var workspaces: string = ""
|
|
)
|
|
input post_trigger: Block<void>
|
|
input trigger: Block<void>
|
|
output completed: Block<void>
|
|
output continue: Block<void>
|
|
output failed: Block<void>
|
|
output post_completed: Block<void>
|
|
model node_contexts: JavaScriptEngine()
|
|
{
|
|
mainAction: runAction[contexts = node_contexts, logger = logger](
|
|
commands = "node .melodium-ci/github/actions/third/swatinem/rust_cache/ref_v2/dist/restore/index.js",
|
|
env = |wrap<StringMap>(
|
|
|map(
|
|
[|entry(
|
|
"INPUT_PREFIX-KEY",
|
|
prefix_key
|
|
),
|
|
|entry(
|
|
"INPUT_SHARED-KEY",
|
|
shared_key
|
|
),
|
|
|entry(
|
|
"INPUT_KEY",
|
|
key
|
|
),
|
|
|entry(
|
|
"INPUT_ENV-VARS",
|
|
env_vars
|
|
),
|
|
|entry(
|
|
"INPUT_WORKSPACES",
|
|
workspaces
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-DIRECTORIES",
|
|
cache_directories
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-TARGETS",
|
|
cache_targets
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-ON-FAILURE",
|
|
cache_on_failure
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-ALL-CRATES",
|
|
cache_all_crates
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-WORKSPACE-CRATES",
|
|
cache_workspace_crates
|
|
),
|
|
|entry(
|
|
"INPUT_SAVE-IF",
|
|
save_if
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-PROVIDER",
|
|
cache_provider
|
|
),
|
|
|entry(
|
|
"INPUT_CACHE-BIN",
|
|
cache_bin
|
|
),
|
|
|entry(
|
|
"INPUT_LOOKUP-ONLY",
|
|
lookup_only
|
|
)]
|
|
)
|
|
),
|
|
name = "rustCache"
|
|
)
|
|
postAction: runAction[contexts = node_contexts, logger = logger](
|
|
commands = "node .melodium-ci/github/actions/third/swatinem/rust_cache/ref_v2/dist/save/index.js",
|
|
if = "success() || env.CACHE_ON_FAILURE == 'true'",
|
|
name = "post:rustCache"
|
|
)
|
|
replicateContextsWithInputs[action_contexts = node_contexts, main_contexts = contexts](
|
|
inputs = |map(
|
|
[|entry(
|
|
"prefix-key",
|
|
prefix_key
|
|
),
|
|
|entry(
|
|
"shared-key",
|
|
shared_key
|
|
),
|
|
|entry(
|
|
"key",
|
|
key
|
|
),
|
|
|entry(
|
|
"env-vars",
|
|
env_vars
|
|
),
|
|
|entry(
|
|
"workspaces",
|
|
workspaces
|
|
),
|
|
|entry(
|
|
"cache-directories",
|
|
cache_directories
|
|
),
|
|
|entry(
|
|
"cache-targets",
|
|
cache_targets
|
|
),
|
|
|entry(
|
|
"cache-on-failure",
|
|
cache_on_failure
|
|
),
|
|
|entry(
|
|
"cache-all-crates",
|
|
cache_all_crates
|
|
),
|
|
|entry(
|
|
"cache-workspace-crates",
|
|
cache_workspace_crates
|
|
),
|
|
|entry(
|
|
"save-if",
|
|
save_if
|
|
),
|
|
|entry(
|
|
"cache-provider",
|
|
cache_provider
|
|
),
|
|
|entry(
|
|
"cache-bin",
|
|
cache_bin
|
|
),
|
|
|entry(
|
|
"lookup-only",
|
|
lookup_only
|
|
)]
|
|
)
|
|
)
|
|
|
|
Self.post_trigger -> postAction.trigger
|
|
postAction.completed -> Self.post_completed
|
|
Self.trigger -> replicateContextsWithInputs.trigger
|
|
replicateContextsWithInputs.ready -> mainAction.trigger
|
|
mainAction.completed -> Self.completed
|
|
mainAction.failed -> Self.failed
|
|
mainAction.continue -> Self.continue
|
|
}
|
|
|