Skip to content

Leverage PowerShellBuild + Migrate to Pester 5 Tests#419

Merged
psjamesp merged 2 commits intoPowerShellOrg:masterfrom
HeyItsGilbert:master
Oct 4, 2021
Merged

Leverage PowerShellBuild + Migrate to Pester 5 Tests#419
psjamesp merged 2 commits intoPowerShellOrg:masterfrom
HeyItsGilbert:master

Conversation

@HeyItsGilbert
Copy link
Copy Markdown
Member

I tried (and failed) at keeping this small. My goal was to migrate to a cleaner build process so that future developers would have an easier time building and testing. With the build improved, this meant that publishing also became trivial. A lot of this came from looking at how @devblackops has devblackops/stucco setup.

Changes to the Actual Module

  • I had to remove Plaster\ references in Plaster/InvokePlaster.ps1 because this was causing the builds to fail for Ubuntu and Mac.
  • src was renamed to Plaster to allow BuildHelpers to more easily determine the module.
  • test was renamed to tests.

Changes to Tests

  • Tests now run in Pester 5
  • Tests leverage BeforeDiscovery or BeforeAll where appropriate
    • This means that the shared script was no longer necessary.
  • Tests now leverage the Test:\ directory.
    • In a few cases where file compares were necessary, we use a GetFullPath command (copied from Pester documentation) to

New Build

  • Leverage PowerShellBuild and BuildHelpers helper modules to make building seamless.
    • Previous version was failing to build in PS7.
    • Variables wouldn't resolve neatly causing artifacts to end up in C:\.

Workflow Changes

  • Extra workflows (including one in root) were removed.
  • PesterReports workflow updated to use new build script + EnricoMi/publish-unit-test-result-action@v1
  • Add new Publish workflow.
    • This will require adding the nuget api key to the github settings + grabbing a certificate from the appropriate location.

Minor Changes

  • A few spacing changes due to auto format on save.
  • Changes to the docs were auto generated.

@HeyItsGilbert
Copy link
Copy Markdown
Member Author

HeyItsGilbert commented Oct 4, 2021

Hopefully resolves #345. When folks submit PR's in the Future, they'll get a nice test result comment added. Something like https://github.com/HeyItsGilbert/Plaster/runs/3786247775?check_suite_focus=true

If you're curious what the actual build looks like: https://github.com/HeyItsGilbert/Plaster/runs/3786232749?check_suite_focus=true#step:4:1

@psjamesp
Copy link
Copy Markdown
Contributor

psjamesp commented Oct 4, 2021

Approved.

@psjamesp psjamesp merged commit 45a9910 into PowerShellOrg:master Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants