1 use crate::builder::{Builder, RunConfig, ShouldRun, Step};
3 use std::process::Command;
5 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
6 pub struct ExpandYamlAnchors;
8 impl Step for ExpandYamlAnchors {
11 /// Runs the `expand-yaml_anchors` tool.
13 /// This tool in `src/tools` read the CI configuration files written in YAML and expands the
14 /// anchors in them, since GitHub Actions doesn't support them.
15 fn run(self, builder: &Builder<'_>) {
16 builder.info("Expanding YAML anchors in the GitHub Actions configuration");
19 &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("generate").arg(&builder.src),
23 fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
24 run.path("src/tools/expand-yaml-anchors")
27 fn make_run(run: RunConfig<'_>) {
28 run.builder.ensure(ExpandYamlAnchors);
32 fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool {
33 if !builder.fail_fast {
34 if !builder.try_run(cmd) {
35 let mut failures = builder.delayed_failures.borrow_mut();
36 failures.push(format!("{:?}", cmd));