Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/Workflow-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ on: [pull_request]

jobs:
WorkflowTestDefault:
uses: ./.github/workflows/workflow.yml
uses: ./.github/workflows/workflow.test.yml
secrets: inherit
with:
Name: PSModule
Path: tests/src
ModulesOutputPath: tests/outputs/modules
DocsOutputPath: tests/outputs/docs
TestProcess: true
97 changes: 97 additions & 0 deletions .github/workflows/workflow.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Process-PSModule

on:
workflow_call:
secrets:
APIKey:
description: The API key to use when publishing modules
required: true
inputs:
Name:
type: string
description: The name of the module to process. Scripts default to the repository name if nothing is specified.
required: false
Path:
type: string
description: The path to the source code of the module.
required: false
default: src
ModulesOutputPath:
type: string
description: The path to the output directory for the modules.
required: false
default: outputs/modules
DocsOutputPath:
type: string
description: The path to the output directory for the documentation.
required: false
default: outputs/docs
SkipTests:
type: boolean
description: Whether to skip tests.
required: false
default: false
TestProcess:
type: boolean
description: Whether to test the process.
required: false
default: false

env:
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication

jobs:
Process-PSModule:
name: Process module
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Checkout tests -> PSModuleTest
uses: actions/checkout@v4
if: ${{ inputs.TestProcess == true }}
with:
repository: PSModule/PSModuleTest
path: tests

- name: Delete outputs
if: ${{ inputs.TestProcess == true }}
shell: pwsh
run: |
Remove-Item -Path tests/outputs -Recurse -Force -Verbose

- name: Initialize environment
uses: PSModule/Initialize-PSModule@v1

- name: Test source code
uses: PSModule/Test-PSModule@v1
if: ${{ inputs.SkipTests != true }}
with:
Name: ${{ inputs.Name }}
Path: ${{ inputs.Path }}
RunModuleTests: false

- name: Build module
uses: PSModule/Build-PSModule@v1
with:
Name: ${{ inputs.Name }}
Path: ${{ inputs.Path }}
ModulesOutputPath: ${{ inputs.ModulesOutputPath }}
DocsOutputPath: ${{ inputs.DocsOutputPath }}

- name: Test built module
uses: PSModule/Test-PSModule@v1
if: ${{ inputs.SkipTests != true }}
with:
Name: ${{ inputs.Name }}
Path: ${{ inputs.ModulesOutputPath }}

- name: Publish module
uses: PSModule/Publish-PSModule@v1
with:
Name: ${{ inputs.Name }}
ModulePath: ${{ inputs.ModulesOutputPath }}
DocsPath: ${{ inputs.DocsOutputPath }}
APIKey: ${{ secrets.APIKEY }}
WhatIf: ${{ inputs.TestProcess }}
29 changes: 22 additions & 7 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ on:
type: string
description: The name of the module to process. Scripts default to the repository name if nothing is specified.
required: false
Path:
type: string
description: The path to the source code of the module.
required: false
default: src
ModulesOutputPath:
type: string
description: The path to the output directory for the modules.
required: false
default: outputs/modules
DocsOutputPath:
type: string
description: The path to the output directory for the documentation.
required: false
default: outputs/docs
SkipTests:
type: boolean
description: Whether to skip tests.
Expand Down Expand Up @@ -41,29 +56,29 @@ jobs:
if: ${{ inputs.SkipTests != true }}
with:
Name: ${{ inputs.Name }}
Path: src
Path: ${{ inputs.Path }}
RunModuleTests: false

- name: Build module
uses: PSModule/Build-PSModule@v1
with:
Name: ${{ inputs.Name }}
Path: src
ModulesOutputPath: outputs/modules
DocsOutputPath: outputs/docs
Path: ${{ inputs.Path }}
ModulesOutputPath: ${{ inputs.ModulesOutputPath }}
DocsOutputPath: ${{ inputs.DocsOutputPath }}

- name: Test built module
uses: PSModule/Test-PSModule@v1
if: ${{ inputs.SkipTests != true }}
with:
Name: ${{ inputs.Name }}
Path: outputs/modules
Path: ${{ inputs.ModulesOutputPath }}

- name: Publish module
uses: PSModule/Publish-PSModule@v1
with:
Name: ${{ inputs.Name }}
ModulePath: outputs/modules
DocsPath: outputs/docs
ModulePath: ${{ inputs.ModulesOutputPath }}
DocsPath: ${{ inputs.DocsOutputPath }}
APIKey: ${{ secrets.APIKEY }}
WhatIf: ${{ inputs.TestProcess }}
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ The workflow is designed to be trigger on pull requests to the repository's defa
When a pull request is opened, closed, reopened, synchronized (push), or labeled, the workflow will run.
Depending on the labels in the pull requests, the workflow will result in different outcomes.

- [Initialize-PSModule](https://github.com/PSModule/Initialize-PSModule/) - To prepare the runner for all requirements of the framework.
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Testing the source code using only PSScriptAnalyzer and the PSModule test suites.
- [Build-PSModule](https://github.com/PSModule/Build-PSModule/) - To compile the repository into an efficient PowerShell module.
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Testing the compiled module using PSScriptAnalyzer, PSModule test suites and custom module tests.
- [Publish-PSModule](https://github.com/PSModule/Publish-PSModule/) - Publish the module to the PowerShell Gallery, publish docs to GitHub Pages, and create a release on the GitHub repository.
- [Initialize-PSModule](https://github.com/PSModule/Initialize-PSModule/) - Prepares the runner with all the framework requirements.
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Tests the source code using only PSScriptAnalyzer and the PSModule test suites.
- [Build-PSModule](https://github.com/PSModule/Build-PSModule/) - Compiles the repository into an efficient PowerShell module.
- [Test-PSModule](https://github.com/PSModule/Test-PSModule/) - Tests the compiled module using PSScriptAnalyzer, PSModule and module tests suites from the module repository.
- [Publish-PSModule](https://github.com/PSModule/Publish-PSModule/) - Publishes the module to the PowerShell Gallery, docs to GitHub Pages, and creates a release on the GitHub repository.

To use the workflow, create a new file in the `.github/workflows` directory of the module repository and add the following content.
<details>
Expand Down Expand Up @@ -64,6 +64,9 @@ jobs:
| Name | Type | Description | Required | Default |
| ---- | ---- | ----------- | -------- | ------- |
| `Name` | `string` | The name of the module to process. This defaults to the repository name if nothing is specified. | `false` | N/A |
| `Path` | `string` | The path to the source code of the module. | `false` | `src` |
| `ModulesOutputPath` | `string` | The path to the output directory for the modules. | `false` | `outputs/modules` |
| `DocsOutputPath` | `string` | The path to the output directory for the documentation. | `false` | `outputs/docs` |
| `SkipTests` | `boolean` | Whether to skip the tests. | false | `false` |
| `TestProcess` | `boolean` | Whether to test the process. | false | `false` |

Expand Down
5 changes: 0 additions & 5 deletions src/PSModule/PSModule.psd1

This file was deleted.

32 changes: 0 additions & 32 deletions src/PSModule/PSModule.psm1

This file was deleted.

18 changes: 0 additions & 18 deletions src/PSModule/public/Test-PSModule.ps1

This file was deleted.

11 changes: 0 additions & 11 deletions tests/PSModule.Tests.ps1

This file was deleted.