Skip to content

Initialize PSMA: one library-backed action dispatched by Mode#1

Open
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
mainfrom
initialize-psma-library
Open

Initialize PSMA: one library-backed action dispatched by Mode#1
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
mainfrom
initialize-psma-library

Conversation

@MariusStorhaug

Copy link
Copy Markdown
Member

Initialize PSMA — one library-backed action, dispatched by Mode

This lays the foundation for consolidating the framework's internal actions into a
single repository with a single lifecycle. It introduces one internal PowerShell
library
that holds all framework action logic and one composite action whose
control script (main.ps1) loads the library and dispatches on a Mode input.

It replaces the fleet of one-capability action repositories (Build-PSModule,
Test-PSModule, Publish-PSModule, Resolve-PSModuleVersion,
Get-PSModuleSettings, Document-PSModule, Get-PesterCodeCoverage,
Get-PesterTestResults, Install-PSModuleHelpers) with one place to version, test,
and release them together.

Design

action.yml            single composite action; input `Mode` + parameters
└─ src/main.ps1       control script: imports the library, switches on Mode
   └─ src/PSMA/       the single internal library, reused by every mode
      ├─ functions/public/    one function per mode + the Initialize bootstrap
      └─ functions/private/   shared helpers reused across all modes
  • The library is imported once and reused across every call, so version/build/test/
    publish logic lives in one module instead of being duplicated per action.
  • Shared helpers (Write-PSMALog, Get-PSMAInput, Set-PSMAOutput,
    Get-PSMAModuleName) are defined once and used by every mode — this is what
    simplifies the individual action calls.
  • Initialize-PSMA is the shared bootstrap that replaces the
    Install-PSModuleHelpers action.

Modes

Mode Library function Ports logic from
Settings Get-PSMASettings Get-PSModuleSettings
Version Resolve-PSMAVersion Resolve-PSModuleVersion
Build Build-PSMAModule Build-PSModule
Test Test-PSMAModule Test-PSModule
CodeCoverage Get-PSMACodeCoverage Get-PesterCodeCoverage
TestResults Get-PSMATestResult Get-PesterTestResults
Document Build-PSMADocumentation Document-PSModule
Publish Publish-PSMAModule Publish-PSModule

Testability

Because the action and the library live in one repo, CI tests both at the branch:

  • Test-Module — Pester tests the library (module surface, shared helpers, Build mode).
  • Action-Test — runs the action (uses: ./) for Settings, Version, and Build
    and asserts the outputs and the built manifest.
  • Lint — PSScriptAnalyzer at error severity.

Consumers

A caller picks the task with Mode, otherwise nothing about how they invoke it changes:

- uses: PSModule/PSMA@<sha> # vX.Y.Z
  with:
    Mode: Build
    Name: MyModule
    Version: 1.2.3

Not yet (follow-up)

Each mode function is a working skeleton with a PORT FROM: marker; the real logic
from each existing action is moved in as a follow-up (one PR per capability), the
generic actions (GitHub-Script, Invoke-Pester, Invoke-ScriptAnalyzer) stay
standalone, and the reusable workflows are re-pointed at PSMA last.

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