tazel
A build system for C, C++, Objective-C, Objective-C++ and Zig, with C# project files.
Clonegit clone https://git.progmasoft.com/tazel
Keep --color in CI, report only actions that failed, build with LLVM 23 on Windows
- Commit
9c03e6c6c701bfb8dc5851ea128d6c54b27ed1a2- Author
- Leitwolf11 ·
- Parents
9bc494a9b2be
Changes
.github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ src/Progmasoft.Tazel/Driver/Executor.cs | 6 ++++++ src/Progmasoft.Tazel/Driver/Processes.cs | 7 ++++--- src/Progmasoft.Tazel/Output/Reporter.cs | 6 ++++++ 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ce1290..c71a76f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,32 @@ jobs: if ($_ -match '^(INCLUDE|LIB|LIBPATH|PATH)=(.*)$') { "$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 } } + # The STL of this Visual Studio needs Clang 22 or newer, which the image does not have: LLVM 23.1.5, checked against + # the SHA-256 of its release, comes first on PATH. + - name: Restore LLVM + if: runner.os == 'Windows' + id: llvm + uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0 + with: + path: ${{ runner.temp }}/llvm + key: llvm-23.1.5-x86_64-pc-windows-msvc + + - name: Install LLVM + if: runner.os == 'Windows' && steps.llvm.outputs.cache-hit != 'true' + shell: bash + run: | + curl -fsSL -o "$RUNNER_TEMP/llvm.tar.zst" "https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.5/clang%2Bllvm-23.1.5-x86_64-pc-windows-msvc.tar.zst" + echo "b2be33385ddc86e83511417a060de927ae8b09d1f3017cc3cdce5c73cd5029d7 $RUNNER_TEMP/llvm.tar.zst" | sha256sum -c - + mkdir -p "$RUNNER_TEMP/llvm" + tar --zstd -xf "$RUNNER_TEMP/llvm.tar.zst" -C "$RUNNER_TEMP/llvm" --strip-components=1 + + - name: Put LLVM first on PATH + if: runner.os == 'Windows' + shell: pwsh + run: | + $path = "${env:RUNNER_TEMP}\llvm\bin;${env:PATH}" + "PATH=$path" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + # Warnings are errors in every project (Directory.Build.props). - name: Build run: dotnet build Tazel.slnx -c Release diff --git a/src/Progmasoft.Tazel/Driver/Executor.cs b/src/Progmasoft.Tazel/Driver/Executor.cs index 0352461..63042d9 100644 --- a/src/Progmasoft.Tazel/Driver/Executor.cs +++ b/src/Progmasoft.Tazel/Driver/Executor.cs @@ -79,6 +79,12 @@ internal sealed class Executor(int jobs, bool keepGoing, ActionCache cache, Repo cache.Forget(action); var result = await Processes.RunAsync(action.Command, action.Directory, action.Environment, null, stop.Token) .ConfigureAwait(false); + if (result.Canceled) + { + // Stopped because another action failed: that one is reported, this one did not fail. + return false; + } + var missing = action.Outputs.FirstOrDefault(output => !File.Exists(action.Full(output))); if (result.ExitCode != 0 || missing is not null) { diff --git a/src/Progmasoft.Tazel/Driver/Processes.cs b/src/Progmasoft.Tazel/Driver/Processes.cs index 7cdd98c..a0cee24 100644 --- a/src/Progmasoft.Tazel/Driver/Processes.cs +++ b/src/Progmasoft.Tazel/Driver/Processes.cs @@ -15,7 +15,8 @@ namespace Progmasoft.Tazel.Driver; /// <param name="ExitCode">The exit status; -1 when it could not start or ran out of time.</param> /// <param name="Output">What it printed.</param> /// <param name="TimedOut">Whether it was stopped because it ran out of time.</param> -internal sealed record ProcessResult(int ExitCode, string Output, bool TimedOut = false); +/// <param name="Canceled">Whether it was stopped because the command stopped, such as after another action failed.</param> +internal sealed record ProcessResult(int ExitCode, string Output, bool TimedOut = false, bool Canceled = false); /// <summary>Starts programs directly, with an argument list and no shell between.</summary> internal static class Processes @@ -85,8 +86,8 @@ internal static class Processes { process.Kill(entireProcessTree: true); await process.WaitForExitAsync(CancellationToken.None).ConfigureAwait(false); - var timedOut = !cancel.IsCancellationRequested; - return new ProcessResult(-1, Text(output), TimedOut: timedOut); + var canceled = cancel.IsCancellationRequested; + return new ProcessResult(-1, Text(output), TimedOut: !canceled, Canceled: canceled); } // WaitForExitAsync returns once the output has been read to its end as well. diff --git a/src/Progmasoft.Tazel/Output/Reporter.cs b/src/Progmasoft.Tazel/Output/Reporter.cs index 191d3e4..9f8127e 100644 --- a/src/Progmasoft.Tazel/Output/Reporter.cs +++ b/src/Progmasoft.Tazel/Output/Reporter.cs @@ -63,7 +63,13 @@ internal sealed class Reporter }, ColorSystem = color == When.Never ? ColorSystemSupport.NoColors : ColorSystemSupport.Detect, Out = output is null ? null : new AnsiConsoleOutput(output), + // The enrichers of CI services turn ANSI on by themselves; --color decides here, and auto detects alone. + Enrichment = new ProfileEnrichment { UseDefaultEnrichers = color == When.Auto }, }); + if (color != When.Auto) + { + console.Profile.Capabilities.Ansi = color == When.Always; + } // Lines that go to a file or a pipe are not wrapped: a command line stays one line. if (output is not null || System.Console.IsOutputRedirected)