-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Labels
automationCI/CD and automation improvementsCI/CD and automation improvementsenhancementNew feature or requestNew feature or requestgithub-actionsGitHub Actions workflowsGitHub Actions workflowsworkflowsGitHub Actions workflowsGitHub Actions workflows
Description
Summary
Create a reusable GitHub Actions workflow for running Pester tests, following the established pattern from ps-script-analyzer.yml.
Parent Issue: #190
Requirements
- Create
.github/workflows/pester-tests.ymlas reusable workflow - Support
workflow_calltrigger with inputs:soft-fail(boolean, default: false)changed-files-only(boolean, default: true)
- Install Pester 5.x from PSGallery
- Run tests using configuration from
scripts/tests/pester.config.ps1 - Upload NUnit XML results as artifact
- Enable GitHub Actions annotations via Pester's CIFormat
Implementation Details
Workflow Structure
name: Pester Tests
on:
workflow_call:
inputs:
soft-fail:
description: 'Whether to continue on test failures'
required: false
type: boolean
default: false
changed-files-only:
description: 'Only test changed PowerShell files'
required: false
type: boolean
default: true
permissions:
contents: read
jobs:
pester:
name: PowerShell Tests
runs-on: ubuntu-latest
# ... steps followKey Steps
- Checkout with
fetch-depth: 0(needed for git diff in changed-files-only mode) - Install Pester from PSGallery (
Install-Module -Name Pester -MinimumVersion 5.0.0) - Run Pester with configuration file
- Upload test results artifact (
if: always()) - Check results and fail job if needed (respecting
soft-fail)
Repository Conventions
- SHA-pinned actions with version comments (e.g.,
@sha # v4.2.2) persist-credentials: falseon checkoutpermissions: contents: readbaseline
Acceptance Criteria
- Workflow file exists at
.github/workflows/pester-tests.yml - Workflow triggers on
workflow_callonly -
soft-failandchanged-files-onlyinputs work correctly - Pester 5.x installs successfully on ubuntu-latest
- Test results uploaded as
pester-test-resultsartifact - Actions follow SHA-pinning convention with version comments
Dependencies
- [Issue]: Add Pester test infrastructure (config, directories, shared mocks) #193 (infrastructure) must be merged first
Estimated Effort
1-2 hours
Additional Context
Reference Implementation
See existing workflow pattern:
.github/workflows/ps-script-analyzer.yml- Reusable workflow structure to follow
Related Issues
- Depends on: [Issue]: Add Pester test infrastructure (config, directories, shared mocks) #193 (infrastructure)
- Blocks: PR integration sub-issue
- Parent: [Issue]: Add Pester unit testing framework for PowerShell scripts #190
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
automationCI/CD and automation improvementsCI/CD and automation improvementsenhancementNew feature or requestNew feature or requestgithub-actionsGitHub Actions workflowsGitHub Actions workflowsworkflowsGitHub Actions workflowsGitHub Actions workflows