-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from theohbrothers/enhancement/ci-add-integrat…
…ion-tests Enhancement (ci): Add integration tests
- Loading branch information
Showing
6 changed files
with
336 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"inputs": [ | ||
{ | ||
"id": "NUGET_API_KEY", | ||
"description": "NUGET_API_KEY?", | ||
"type": "promptString", | ||
"default": "xxx", | ||
}, | ||
{ | ||
"id": "MODULE_VERSION", | ||
"description": "MODULE_VERSION?", | ||
"type": "promptString", | ||
"default": "0.0.0", | ||
}, | ||
], | ||
"tasks": [ | ||
{ | ||
"label": "Test (pwsh)", | ||
"type": "shell", | ||
"command": "pwsh -Command test/test.ps1", | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Test (powershell)", | ||
"type": "shell", | ||
"command": "powershell -Command test/test.ps1", | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Build: Generate module manifest", | ||
"type": "shell", | ||
"command": "MODULE_VERSION=${input:MODULE_VERSION} pwsh src/PSModulePublisher/Public/Invoke-Build.ps1", | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Publish module (dry run)", | ||
"dependsOn":[ | ||
"Build: Generate module manifest" | ||
], | ||
"type": "shell", | ||
"command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery -DryRun", | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Publish module", | ||
"dependsOn":[ | ||
"Build: Generate module manifest" | ||
], | ||
"type": "shell", | ||
"command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery", | ||
"group": "build" | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Describe "Invoke-PSModulePublisher" -Tag 'Integration' { | ||
BeforeEach { | ||
$moduleDir = $PSScriptRoot | ||
$mockModuleRepoDir = (Resolve-Path "$PSScriptRoot/../../test/Mock-Module").Path | ||
$mockModuleManifest = (Resolve-Path "$mockModuleRepoDir/src/Mock-Module/Mock-Module.psd1").Path | ||
Push-Location $mockModuleRepoDir | ||
$env:PROJECT_BASE_DIR = $mockModuleRepoDir # Override the project base | ||
} | ||
AfterEach { | ||
Pop-Location | ||
} | ||
It "Runs Invoke-Build.ps1" { | ||
$moduleManifest = & "$moduleDir/Public/Invoke-Build.ps1" | ||
$moduleManifest | Should -Be $mockModuleManifest | ||
} | ||
It "Runs Invoke-Publish.ps1" { | ||
$env:MODULE_VERSION = '0.0.0' | ||
$env:NUGET_API_KEY = 'xxx' | ||
& "$moduleDir/Public/Invoke-Publish.ps1" -ModuleManifestPath $mockModuleManifest -Repository PSGallery -DryRun | ||
} | ||
It "Runs Invoke-Test.ps1" { | ||
& "$moduleDir/Public/Invoke-Test.ps1" -ModuleManifestPath $mockModuleManifest | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# - Initial setup: Fill in the GUID value. Generate one by running the command 'New-GUID'. Then fill in all relevant details. | ||
# - Ensure all relevant details are updated prior to publishing each version of the module. | ||
# - To simulate generation of the manifest based on this definition, run the included development entrypoint script Invoke-PSModulePublisher.ps1. | ||
# - To publish the module, tag the associated commit and push the tag. | ||
@{ | ||
RootModule = 'Mock-Module.psm1' | ||
# ModuleVersion = '' # Value will be set for each publication based on the tag ref. Defaults to '0.0.0' in development environments and regular CI builds | ||
GUID = 'e3df9fcc-9f83-4c93-9d06-4d2523376af7' | ||
Author = 'The Oh Brothers' | ||
CompanyName = 'The Oh Brothers' | ||
Copyright = '(c) 2023 The Oh Brothers' | ||
Description = 'Some description' | ||
PowerShellVersion = '3.0' | ||
# PowerShellHostName = '' | ||
# PowerShellHostVersion = '' | ||
# DotNetFrameworkVersion = '' | ||
# CLRVersion = '' | ||
# ProcessorArchitecture = '' | ||
# RequiredModules = @( | ||
# @{ | ||
# ModuleName = "PSMockModule" | ||
# RequiredVersion = '0.0.2' | ||
# } | ||
# ) | ||
# RequiredAssemblies = @() | ||
# ScriptsToProcess = @() | ||
# TypesToProcess = @() | ||
# FormatsToProcess = @() | ||
# NestedModules = @() | ||
FunctionsToExport = @( | ||
Get-ChildItem $PSScriptRoot/../../src/Mock-Module/Public -Exclude *.Tests.ps1 | % { $_.BaseName } | ||
) | ||
CmdletsToExport = @() | ||
VariablesToExport = @() | ||
AliasesToExport = @() | ||
# DscResourcesToExport = @() | ||
# ModuleList = @() | ||
# FileList = @( | ||
# & { | ||
# Set-Location $PSScriptRoot/../../../src/Generate-DockerImageVariants/ | ||
# Get-ChildItem -File -Recurse -Force | Resolve-Path -Relative | ||
# Set-Location - | ||
# } | ||
# ) | ||
PrivateData = @{ | ||
# PSData = @{ # Properties within PSData will be correctly added to the manifest via Update-ModuleManifest without the PSData key. Leave the key commented out. | ||
Tags = @( | ||
'mock' | ||
'module' | ||
) | ||
LicenseUri = 'https://raw.githubusercontent.com/theohbrothers/Mock-Module/master/LICENSE' | ||
ProjectUri = 'https://github.com/theohbrothers/Mock-Module' | ||
# IconUri = '' | ||
# ReleaseNotes = '' | ||
# Prerelease = '' | ||
# RequireLicenseAcceptance = $false | ||
ExternalModuleDependencies = @() | ||
# } | ||
# HelpInfoURI = '' | ||
# DefaultCommandPrefix = '' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# | ||
# Module manifest for module 'Mock-Module' | ||
# | ||
# Generated by: The Oh Brothers | ||
# | ||
# Generated on: 09/08/2023 | ||
# | ||
|
||
@{ | ||
|
||
# Script module or binary module file associated with this manifest. | ||
RootModule = 'Mock-Module.psm1' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '0.0.0' | ||
|
||
# Supported PSEditions | ||
# CompatiblePSEditions = @() | ||
|
||
# ID used to uniquely identify this module | ||
GUID = 'e3df9fcc-9f83-4c93-9d06-4d2523376af7' | ||
|
||
# Author of this module | ||
Author = 'The Oh Brothers' | ||
|
||
# Company or vendor of this module | ||
CompanyName = 'The Oh Brothers' | ||
|
||
# Copyright statement for this module | ||
Copyright = '(c) 2023 The Oh Brothers' | ||
|
||
# Description of the functionality provided by this module | ||
Description = 'Some description' | ||
|
||
# Minimum version of the PowerShell engine required by this module | ||
PowerShellVersion = '3.0' | ||
|
||
# Name of the PowerShell host required by this module | ||
# PowerShellHostName = '' | ||
|
||
# Minimum version of the PowerShell host required by this module | ||
# PowerShellHostVersion = '' | ||
|
||
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. | ||
# DotNetFrameworkVersion = '' | ||
|
||
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. | ||
# ClrVersion = '' | ||
|
||
# Processor architecture (None, X86, Amd64) required by this module | ||
# ProcessorArchitecture = '' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
# RequiredModules = @() | ||
|
||
# Assemblies that must be loaded prior to importing this module | ||
# RequiredAssemblies = @() | ||
|
||
# Script files (.ps1) that are run in the caller's environment prior to importing this module. | ||
# ScriptsToProcess = @() | ||
|
||
# Type files (.ps1xml) to be loaded when importing this module | ||
# TypesToProcess = @() | ||
|
||
# Format files (.ps1xml) to be loaded when importing this module | ||
# FormatsToProcess = @() | ||
|
||
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess | ||
# NestedModules = @() | ||
|
||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. | ||
FunctionsToExport = @() | ||
|
||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. | ||
CmdletsToExport = @() | ||
|
||
# Variables to export from this module | ||
# VariablesToExport = @() | ||
|
||
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. | ||
AliasesToExport = @() | ||
|
||
# DSC resources to export from this module | ||
# DscResourcesToExport = @() | ||
|
||
# List of all modules packaged with this module | ||
# ModuleList = @() | ||
|
||
# List of all files packaged with this module | ||
# FileList = @() | ||
|
||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
PrivateData = @{ | ||
|
||
PSData = @{ | ||
|
||
# Tags applied to this module. These help with module discovery in online galleries. | ||
Tags = 'mock','module' | ||
|
||
# A URL to the license for this module. | ||
LicenseUri = 'https://raw.githubusercontent.com/theohbrothers/Mock-Module/master/LICENSE' | ||
|
||
# A URL to the main website for this project. | ||
ProjectUri = 'https://github.com/theohbrothers/Mock-Module' | ||
|
||
# A URL to an icon representing this module. | ||
# IconUri = '' | ||
|
||
# ReleaseNotes of this module | ||
# ReleaseNotes = '' | ||
|
||
# Prerelease string of this module | ||
# Prerelease = '' | ||
|
||
# Flag to indicate whether the module requires explicit user acceptance for install/update/save | ||
# RequireLicenseAcceptance = $false | ||
|
||
# External dependent modules of this module | ||
# ExternalModuleDependencies = @() | ||
|
||
} # End of PSData hashtable | ||
|
||
} # End of PrivateData hashtable | ||
|
||
# HelpInfo URI of this module | ||
# HelpInfoURI = '' | ||
|
||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | ||
# DefaultCommandPrefix = '' | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$script:MODULE_BASE_DIR = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
# $script:MODULE_HELPER_DIR = Join-Path $MODULE_BASE_DIR 'Helper' | ||
# $script:MODULE_PRIVATE_DIR = Join-Path $MODULE_BASE_DIR 'Private' | ||
# $script:MODULE_PUBLIC_DIR = Join-Path $MODULE_BASE_DIR 'Public' | ||
|
||
# Get-ChildItem "$script:MODULE_HELPER_DIR/*.ps1" -Exclude *.Tests.ps1 | % { | ||
# . $_.FullName | ||
# } | ||
|
||
# Get-ChildItem "$script:MODULE_PRIVATE_DIR/*.ps1" -Exclude *.Tests.ps1 | % { | ||
# . $_.FullName | ||
# } | ||
|
||
# Get-ChildItem "$script:MODULE_PUBLIC_DIR/*.ps1" -Exclude *.Tests.ps1 | % { | ||
# . $_.FullName | ||
# } |