Skip to content

Catesta - GitHub Actions Integration

Synopsis

Scaffolds a new PowerShell module or vault project intended for CI/CD workflow using GitHub Actions.

Getting Started


Note: It is important to have a clear understanding of what your project should support before starting with Catesta. If your goal is to create a cross-platform solution or test multiple versions of PowerShell, consider running multiple build types to ensure proper functioning on various platforms and environments.

GitHub Actions Supported Builds:

Cross Platform


  1. You will need a GitHub account.
  2. Create a new repository and clone to your local dev device
  3. Create your project using Catesta and select [G] GitHub Actions at the CICD prompt. (Catesta Basics)
  4. Write the logic for your module (the hardest part)
    • All build testing can be done locally by navigating to src and running Invoke-Build
      • By default, this runs all tasks in the build file.
        • If you want to run a specific task from the build file you can provide the task name. For example, to just execute Pester tests for your project: Invoke-Build -Task Test
    • If using VSCode as your primary editor you can use VSCode tasks to perform various local actions
      • Open the VSCode Command palette
        • Shift+Command+P (Mac) / Ctrl+Shift+P (Windows/Linux) or F1
      • Type Tasks: Run Task
      • Select the task to run
        • Examples:
          • task . - Runs complete build (all tasks)
          • task Test - Invokes all Pester Unit Tests
          • task Analyze - Invokes Script Analyzer checks
          • task DevCC - Generates generate xml file to graphically display code coverage in VSCode using Coverage Gutters
  5. Add any module dependencies to your CI/CD bootstrap file: actions_bootstrap.ps1
  6. Upload to your GitHub repository which now has a triggered/monitored build action.
  7. Evaluate results of your build and display your GitHub Actions badge proudly!

GitHub Actions project created by Catesta

Test Reports

GitHub Actions does not natively support Test reports. There are many Test Report solutions in the Actions Marketplace that can accomplish this however.

By default, the build file will create a XML test report in NUnitXml but these can also be changed to JUnitXml if you are using a Test Report in Actions that prefers that format.

Notes

Additional Reading:

Diagrams

GitHub Actions

Catesta PowerShell GitHub Actions Diagram

Example Projects