Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Nuke target build time #32

Open
laurentkempe opened this issue Aug 25, 2022 · 0 comments
Open

Nuke target build time #32

laurentkempe opened this issue Aug 25, 2022 · 0 comments

Comments

@laurentkempe
Copy link
Owner

laurentkempe commented Aug 25, 2022

Graph time spent running tests or any target ran by nuke build
Add a custom build metric to be able to fail the build

Image

See
https://twitter.com/laurentkempe/status/1562741381021716482

See
https://www.jetbrains.com/help/teamcity/2021.2/build-failure-conditions.html#Adding+Custom+Build+Metric

Image

Image

You can also use code to report a metric

protected override void OnTargetSucceeded(string target)
{
	base.OnTargetSucceeded(target);

	if (!target.Equals(nameof(Tests))) return;

	var testsTarget = SucceededTargets.SingleOrDefault(executableTarget => executableTarget.Name.Equals(nameof(Tests)));
	if (testsTarget == null) return;

	Serilog.Log.Information("Tests succeeded in {BCTestsTargetRunDuration}", testsTarget.Duration);

	TeamCity.Instance?.AddStatisticValue("BCTestsTargetRunDuration", testsTarget.Duration.ToString());
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant