Skip to content

Instantly share code, notes, and snippets.

@lipkau
Last active September 25, 2018 08:26
Show Gist options
  • Save lipkau/20e8d0c70657402ae9416bd1484255f3 to your computer and use it in GitHub Desktop.
Save lipkau/20e8d0c70657402ae9416bd1484255f3 to your computer and use it in GitHub Desktop.
A description of a CI/CD pipeline for Powershell

CI/CD Flow description

Assumptions

  • This description uses only major, minor and build in the module's version.
  • This description uses external help instead of Comment-Based help (platyPS).
  • This description uses Pester for running tests.
  • This description hosts the source of github.

Triggers

Trigger: every push on every PR

  1. Build
  2. Test - excluding tag "integration"

Trigger: every push on branch develop

  1. Build
  2. Test
  3. Deploy

Trigger: every push on branch master

  1. Build
  2. Test
  3. Deploy

Tasks

Build

  1. all markdown help files in /docs shall be converted to maml external help and placed into the module's source (not the OutputFolder)
  2. set ModuleVersion in module's manifest to version number (with which it would be published to PSGallery)
    1. if the manifest's ModuleVersion has a higher major version than the last version published to PSGallery, minor and build shall be set to 0 and patch to -1
    2. if the manifest's ModuleVersion has a higher minor version than the last version published to PSGallery, build shall be set to 0 and patch to -1
  3. all .ps1 files in ModulePath/Private shall be appended to the module's .psm1 file
  4. all .ps1 files in ModulePath/Public shall be appended to the module's .psm1 file
  5. the collection of all function in .ps1 files in ModulePath/Public shall set in the module's .psd1 in FunctionsToExport
  6. the collection of all aliases in .ps1 files in ModulePath/Public shall set in the module's .psd1 in AliasesToExport
  7. all additional resources (*.ps1xml, *.cs, about_*.help.txt, *-help.xml, etc) shall copied into the OutputFolder
  8. all files in the OutputFolder shall be UTF-8 without BOM encoded

Test

Test shall be run against:

  • Powershell v5.1 on Windows
  • Powershell v6 (latest) on Windows
  • Powershell v6 (latest) on Ubuntu
  • Powershell v6 (latest) on MacOS
  1. Run Pester against all tests with tag ... and excluding tag ...
  2. Upload test results
  3. Upload code coverage results

Deploy

  1. Publish module in OutputFolder to PSGallery
  2. Tag repository with this version's number
  3. Package (.zip) the OutputFolder
  4. Publish github release with the packaged zip file
  5. (my custom task for updating the documentation on the homepage)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment