Skip to content

ci: skip Pester when a PR changes no module or test code - #152

Merged
mikemadeja merged 1 commit into
developfrom
ci/skip-pester-without-code-changes
Oct 31, 2026
Merged

mikemadeja merged 1 commit into
developfrom
ci/skip-pester-without-code-changes

Conversation

@mikemadeja

@mikemadeja mikemadeja commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Makes the Pester pipeline run only when functions or tests change.

Why #151 ran the full suite

The pipeline already maps changed files to their tests, but when no test matched (a docs-only PR), it fell back to the full suite instead of skipping it.

Changes (azuredevops-pihole-pester-tests.yml)

  • PRs with nothing to test skip Pester. That covers docs, .github/, tools/ and the pipeline file itself. The run still reports success, in seconds, because PesterPiHoleShell is a required check; a path filter on the pr: trigger would leave the check pending and block the merge. Publishing test results is skipped too.

  • Merges into develop/main only start the pipeline when PiHoleShell/ or tests/ changed. That's a path filter on trigger:, which is safe because push builds aren't required checks.

  • Adding a function no longer runs the full suite. The UTF-16 manifest (.psd1) used to count as a core change every time. It's now compared like .psm1: new FunctionsToExport entries only run the changed function's tests, while a removed export or any other manifest change still runs everything.

  • A changed function with no test file of its own runs the full suite, so it can't end up running nothing. Today that applies to Remove-PiHoleAuthSession and Search-PiHoleListDomain.

Unchanged: shared code (Private/, Request-PiHoleAuth, test helpers) still runs the full suite, and so does any error while working out what changed.

Testing

I dry-ran the script's scoping logic locally against real history, with Pester swapped out:

Case Result
Docs-only (#151's branch) Skips Pester, exit 0
Add a function (05a4855, adds Get-PiHoleApiEndpoint) Runs only Get-PiHoleApiEndpoint.Integration.Tests.ps1 (was: full suite)
Remove an export from the .psd1 Full suite
Change a .psd1 setting (PowerShellVersion) Full suite
Edit only Get-PiHoleInfoVersion Runs only Get-PiHoleInfoVersion.Integration.Tests.ps1
Edit only Search-PiHoleListDomain (no test file) Full suite

This PR only changes the pipeline file, so its own Pester check should take the new skip path.

🤖 Generated with Claude Code

A PR whose changes map to no test file (docs, workflows, tools/) fell
through to the full ~1 hour suite. It now passes the required
PesterPiHoleShell check in seconds instead. Merges into develop/main
only trigger the pipeline when PiHoleShell/ or tests/ changed.

Adding a function also ran the full suite, because any change to the
UTF-16 manifest counted as a core change. The manifest is now compared
the same way as the .psm1: new FunctionsToExport entries only run the
changed function's tests, while a removed export or any other manifest
change still runs everything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@mikemadeja
mikemadeja merged commit 88c14ff into develop Oct 31, 2026
4 checks passed
@mikemadeja
mikemadeja deleted the ci/skip-pester-without-code-changes branch October 31, 2026 15:41
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.

1 participant