BuildSetup and BuildTearDown Feature#285
Merged
devblackops merged 13 commits intopsake:masterfrom Aug 16, 2019
Merged
Conversation
…to the psake context
… to the psake context
Member
|
Thanks for the contribution @UberDoodles. This is awesome! |
devblackops
reviewed
Aug 16, 2019
Member
devblackops
left a comment
There was a problem hiding this comment.
I noticed that no task header is displayed when TaskSetup or TaskTearDown are executed, nor are the execution times included in the build time report. I don't think it's a huge deal though. If people are itching to have that we can address it later.
devblackops
added a commit
to devblackops/psake
that referenced
this pull request
Aug 16, 2019
Contributor
Author
|
Thanks @devblackops. Yeah, I wasn't sure whether task headers and timings should be added. I decided to keep it simple for now. Like you say; we can address these later if there is a demand for it. |
This was referenced Aug 23, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Similar to TaskSetup and TaskTearDown, there are now functions to specify code snippets to be executed at the beginning of the build (before the first task), and at the end of the build (after either all tasks have completed, or a task has failed).
This is my first ever contribution to an opensource project, and first time using GitHub, so go easy on me :)
Related Issue
#181
Motivation and Context
In my implementation of psake, I need to perform some processing at the very beginning of the build, before any tasks run.
Previously, I had just worked around this using the TaskSetup functionality, and a variable to track whether the build setup had been performed. This approach isn't compatible with a change which I now want to make to our builds, which requires the build setup to have been performed before the task preconditions execute.
How Has This Been Tested?
Tested on Windows 10 desktop.
Powershell 5.1
.NET Framework 4.8
Pester 4.8.1
PlatyPS 0.14.0
PSScriptAnalyzer 1.18.1
Ran all existing Pester tests, and created some new ones for the new features. I wanted to write a Pester test that ensured the BuildTearDown executed even if the build failed, but I couldn't find a way of doing that which worked with the way the specs were executed.
So I had to do a manual test to verify that the BuildTearDown ran even if a task failed (and that the build still failed after the teardown had completed). Also manually tested that the build works when you don't specify BuildSetup or BuildTearDown. I used the new features in combination with TaskSetup and TaskTearDown to make sure everything was executing in the correct order.
Screenshots (if appropriate):
Types of changes
Checklist: