Skip to content

🪲 [Fix]: Test data reaches module tests in every consumer repository#377

Merged
Marius Storhaug (MariusStorhaug) merged 3 commits into
mainfrom
feat/import-testdata
Jul 11, 2026
Merged

🪲 [Fix]: Test data reaches module tests in every consumer repository#377
Marius Storhaug (MariusStorhaug) merged 3 commits into
mainfrom
feat/import-testdata

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 10, 2026

Copy link
Copy Markdown
Member

Module test workflows now receive the caller-provided test data (secrets and variables) in every repository that consumes Process-PSModule, and version resolution once again honors the bump label on pull requests. Previously the BeforeAll, Test, and AfterAll module jobs failed at the "Expose caller-provided test data" step because they ran a script that shipped only inside Process-PSModule's own repository, so no consumer could actually use the TestData secret introduced in v6.0.0.

Fixed: Test data now reaches module tests in consumer repositories

The TestData secret (a single-line JSON object of secrets and variables) is now exposed to the BeforeAll, Test, and AfterAll module test jobs in any repository that consumes Process-PSModule. Each job installs the shared helpers and runs the Import-TestData command, which reads the payload, masks the secrets, and publishes every entry as an environment variable for the tests.

The consumer interface is unchanged — callers already pass TestData to workflow.yml (added in v6.0.0), so no migration is required:

secrets:
  TestData: >-
    { "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" },
      "variables": { "TEST_VARIABLE": ${{ toJSON(vars.TEST_VARIABLE) }} } }

Secrets arrive masked in the logs; variables arrive verbatim.

Fixed: Bump labels are honored during version resolution on pull requests

Version resolution now always evaluates the Major/Minor/Patch bump label, so a pull request labeled Minor previews the correct next minor version instead of defaulting to a patch prerelease. This is picked up by adopting Resolve-PSModuleVersion v1.1.4.

Technical Details

  • Removed .github/scripts/Expose-TestData.ps1 (138 lines); the exposure logic moved into the shared PSModule/Install-PSModuleHelpers module as the Import-TestData command, so it no longer has to be checked out from the caller's repository.
  • BeforeAll-ModuleLocal.yml, Test-ModuleLocal.yml, and AfterAll-ModuleLocal.yml each now install PSModule/Install-PSModuleHelpers@v1.0.9 and run Import-TestData (env PSMODULE_TEST_DATA: ${{ secrets.TestData }}) in place of the deleted script.
  • Plan.yml: PSModule/Resolve-PSModuleVersion pinned to v1.1.4, which contains the always-evaluate-labels fix.
  • Build-Site.yml: Install-PSModuleHelpers bumped v1.0.8 → v1.0.9 so the action resolves to a single version across the repo.
  • README.md documents that test data is exposed through Install-PSModuleHelpers / Import-TestData.
  • All action references are pinned to release commit SHAs (IPH v1.0.9 = 8bfb84d557755c67d9b5643efe573bdcae4c1a4a, Resolve v1.1.4 = 8d1dac7f326a45ba08060c1e24a5dd6f6f00b3ab); actionlint is clean.
  • Validated end-to-end on a consumer module: all module test matrix jobs (Linux/Windows/macOS) pass, with a masked secret and a verbatim variable observed in the tests.

Replace the caller-shipped ./.github/scripts/Expose-TestData.ps1 with a call to Import-TestData, which is provided by PSModule/Install-PSModuleHelpers. All three ModuleLocal workflows (BeforeAll/Test/AfterAll) now install the helpers and run Import-TestData to expose the caller's secrets/variables to the test jobs; BeforeAll/AfterAll take the Install-PSModuleHelpers dependency they previously lacked. The helpers ref is temporarily @feat/import-testdata for end-to-end testing.
Copilot AI review requested due to automatic review settings July 10, 2026 20:15
Comment thread .github/workflows/AfterAll-ModuleLocal.yml Fixed
Comment thread .github/workflows/BeforeAll-ModuleLocal.yml Fixed
Comment thread .github/workflows/Test-ModuleLocal.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ModuleLocal reusable workflows to expose caller-provided TestData by installing PSModule/Install-PSModuleHelpers and running its new Import-TestData command, replacing the previously caller-shipped .github/scripts/Expose-TestData.ps1 script. This centralizes the logic so consumer repos no longer need to include the script for ModuleLocal jobs to work.

Changes:

  • Replace .github/scripts/Expose-TestData.ps1 usage with Import-TestData in ModuleLocal workflows after installing Install-PSModuleHelpers.
  • Add the missing Install-PSModuleHelpers dependency to BeforeAll-ModuleLocal.yml and AfterAll-ModuleLocal.yml.
  • Update README documentation and remove the now-unused PowerShell script.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Updates documentation to describe the new Import-TestData-based approach via Install-PSModuleHelpers.
.github/workflows/Test-ModuleLocal.yml Installs helpers and calls Import-TestData instead of the deleted script.
.github/workflows/BeforeAll-ModuleLocal.yml Adds helpers install step and switches to Import-TestData.
.github/workflows/AfterAll-ModuleLocal.yml Adds helpers install step and switches to Import-TestData.
.github/scripts/Expose-TestData.ps1 Removes the old caller-shipped implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/Test-ModuleLocal.yml Outdated
Comment thread .github/workflows/BeforeAll-ModuleLocal.yml Outdated
Comment thread .github/workflows/AfterAll-ModuleLocal.yml Outdated
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Temporarily reference PSModule/Resolve-PSModuleVersion@feat/always-evaluate-version-labels so the pipeline previews the label-driven bump (e.g. minor) even on a pull_request event. Pin to a released SHA before merge.
Copilot AI review requested due to automatic review settings July 10, 2026 20:50
Comment thread .github/workflows/Plan.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread .github/workflows/Test-ModuleLocal.yml Outdated
Comment thread .github/workflows/BeforeAll-ModuleLocal.yml Outdated
Comment thread .github/workflows/AfterAll-ModuleLocal.yml Outdated
Comment thread .github/workflows/Plan.yml
Comment thread .github/workflows/Plan.yml Outdated
…v1.1.4

Replaces the temporary E2E branch refs with released commit SHAs now that Import-TestData (IPH v1.0.9) and the always-evaluate-labels fix (Resolve v1.1.4) are released. Also bumps Build-Site's Install-PSModuleHelpers pin to v1.0.9 so the action is uniform across the repo.
Copilot AI review requested due to automatic review settings July 10, 2026 22:12
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title Expose TestData via the Helpers module's Import-TestData command 🪲 [Fix]: Test data reaches module tests in every consumer repository Jul 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/Test-ModuleLocal.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit d4020f3 into main Jul 11, 2026
71 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the feat/import-testdata branch July 11, 2026 08:51
Marius Storhaug (MariusStorhaug) added a commit to MariusStorhaug/MariusTestModule that referenced this pull request Jul 11, 2026
The Import-TestData plumbing and always-evaluate-version-labels fix are now released in Process-PSModule v6.1.2 (via PSModule/Process-PSModule#377, IPH v1.0.9 + Resolve-PSModuleVersion v1.1.4), so the temporary feat/import-testdata branch ref is replaced with the released tag.
Marius Storhaug (MariusStorhaug) added a commit to MariusStorhaug/MariusTestModule that referenced this pull request Jul 11, 2026
End-to-end test of the TestData plumbing fix, exercised through this
module **without merging** the
underlying changes.

## Wiring

- CI calls
`PSModule/Process-PSModule/.github/workflows/workflow.yml@feat/import-testdata`
  (PR PSModule/Process-PSModule#377), which installs
`PSModule/Install-PSModuleHelpers@feat/import-testdata` (PR
PSModule/Install-PSModuleHelpers#20)
  and runs its new `Import-TestData` command.

## What to observe

- **Secrets + variables pushed into the tests** — the calling workflow
passes a `TestData` object with
a `secrets` map (`TEST_SECRET`, masked in logs) and a `variables` map
(`TEST_VARIABLE`, not masked).
`tests/Environment.Tests.ps1` asserts both arrive with their exact
fixture values inside the module
  test job.
- **(A) Versioning** — this PR is labelled `Minor`; the pipeline
computes the next version accordingly.
- **(B) Documentation hierarchy** — public functions are grouped into
sections with landing pages on
  the section nodes:
  - `Greetings/` (landing page from `Greetings.md`) → `Get-Greeting`
- `DateAndTime/` (landing page from `index.md`) → `Get-CurrentDateTime`
  - `Get-PSModuleTest` stays at the top level

> Throwaway E2E harness — not intended to merge.

---------

Co-authored-by: Marius Storhaug <Marius.Storhaug@dnb.no>
Marius Storhaug (MariusStorhaug) added a commit to PSModule/Template-PSModule that referenced this pull request Jul 11, 2026
… (index.md + folder-named) (#27)

Two example command groups demonstrate both supported ways to give a
command group its documentation section landing page. `IndexSection`
provides its landing page as `index.md`; `NamedSection` provides its
landing page as a file named after the folder (`NamedSection.md`).
Document-PSModule renders either overview page as the group's section
landing page, so each group appears at `Functions/<Group>/` in the
navigation of the published GitHub Pages site.

- Demonstrates PSModule/Process-PSModule#372 (group overview pages
become section landing pages)
- Adopts PSModule/Process-PSModule#377 (caller-provided TestData reaches
module tests in consumer repositories)

## New: Two command groups showcasing both landing-page conventions

- `IndexSection/` — landing page from `index.md`, with
`Get-IndexSectionTest`.
- `NamedSection/` — landing page from the folder-named
`NamedSection.md`, with `Get-NamedSectionTest`.

Each renders as its group's section landing page
(`Functions/IndexSection/` and `Functions/NamedSection/`) in the docs
navigation.

## Technical Details

- Adds `src/functions/public/IndexSection/{index.md,
Get-IndexSectionTest.ps1}` and
`src/functions/public/NamedSection/{NamedSection.md,
Get-NamedSectionTest.ps1}`; both functions mirror the existing
`*-PSModuleTest` shape and return `Hello, <Name>!`.
- Adds `It` blocks for `Get-IndexSectionTest` and `Get-NamedSectionTest`
in `tests/PSModuleTest.Tests.ps1`.
- Generated docs place each group overview at `<Group>/index.md`; the
rendered site exposes `Functions/IndexSection/index.html` and
`Functions/NamedSection/index.html`.
- Bumps the Process-PSModule pin (`v6.1.1` → `v6.1.2`) to adopt the fix
that exposes caller-provided `TestData` to the module test jobs, keeping
the module test matrix green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix version resolution ignoring the bump label on pull requests

3 participants