From 2c3cc052228cd7fbc40c264fdd2af493170e6946 Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 24 Mar 2024 17:19:17 -0600 Subject: [PATCH 1/6] fix: Copy template test files to build artifact --- .github/workflows/build-and-test-powershell-module.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-powershell-module.yml b/.github/workflows/build-and-test-powershell-module.yml index 59eb7da..f9fd1ae 100644 --- a/.github/workflows/build-and-test-powershell-module.yml +++ b/.github/workflows/build-and-test-powershell-module.yml @@ -157,9 +157,14 @@ jobs: Write-Output "Testing the module manifest file '$moduleManifestFilePath' to ensure it is valid." Test-ModuleManifest -Path $moduleManifestFilePath - Write-Output "Copying the module files to the module artifact directory '$moduleArtifactDirectoryPath'." + Write-Output "Copying the module files to the module artifact directory '$moduleArtifactDirectoryPath', excluding tests." Copy-Item -Path $moduleDirectoryPath -Destination $moduleArtifactDirectoryPath -Exclude '*.Tests.ps1' -Recurse -Force + [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath 'TemplateFiles' + [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath 'TemplateFiles' + Write-Output "Copying the module template test files to the module artifact directory '$moduleArtifactTemplateFilesDirectoryPath'." + Copy-Item -Path $moduleTemplateFilesDirectoryPath -Destination $moduleArtifactTemplateFilesDirectoryPath -Include '*.Tests.ps1' -Recurse -Force + - name: Create deploy files artifact shell: pwsh run: | From 818c6e4321062a423172afaf76e9e89d00901264 Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 24 Mar 2024 17:35:38 -0600 Subject: [PATCH 2/6] Attempting to copy Tests file properly --- .github/workflows/build-and-test-powershell-module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-powershell-module.yml b/.github/workflows/build-and-test-powershell-module.yml index f9fd1ae..ceba071 100644 --- a/.github/workflows/build-and-test-powershell-module.yml +++ b/.github/workflows/build-and-test-powershell-module.yml @@ -163,7 +163,7 @@ jobs: [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath 'TemplateFiles' [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath 'TemplateFiles' Write-Output "Copying the module template test files to the module artifact directory '$moduleArtifactTemplateFilesDirectoryPath'." - Copy-Item -Path $moduleTemplateFilesDirectoryPath -Destination $moduleArtifactTemplateFilesDirectoryPath -Include '*.Tests.ps1' -Recurse -Force + Copy-Item -Path $moduleTemplateFilesDirectoryPath\* -Destination $moduleArtifactTemplateFilesDirectoryPath -Include '*.Tests.ps1' -Recurse -Force -Container - name: Create deploy files artifact shell: pwsh From eb4ba89b65f25872765a8185262c8370d8ba8829 Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 24 Mar 2024 17:39:09 -0600 Subject: [PATCH 3/6] ci: Fix file path --- .github/workflows/build-and-test-powershell-module.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test-powershell-module.yml b/.github/workflows/build-and-test-powershell-module.yml index ceba071..8ffa6a4 100644 --- a/.github/workflows/build-and-test-powershell-module.yml +++ b/.github/workflows/build-and-test-powershell-module.yml @@ -160,8 +160,8 @@ jobs: Write-Output "Copying the module files to the module artifact directory '$moduleArtifactDirectoryPath', excluding tests." Copy-Item -Path $moduleDirectoryPath -Destination $moduleArtifactDirectoryPath -Exclude '*.Tests.ps1' -Recurse -Force - [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath 'TemplateFiles' - [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath 'TemplateFiles' + [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath 'TemplateRepoFiles' + [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath 'TemplateRepoFiles' Write-Output "Copying the module template test files to the module artifact directory '$moduleArtifactTemplateFilesDirectoryPath'." Copy-Item -Path $moduleTemplateFilesDirectoryPath\* -Destination $moduleArtifactTemplateFilesDirectoryPath -Include '*.Tests.ps1' -Recurse -Force -Container From 1dae2aa6b260189e7b5b0622a31e6d40c9e4f959 Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 24 Mar 2024 17:47:04 -0600 Subject: [PATCH 4/6] ci: Trying to fix build artifacts --- .github/workflows/build-and-test-powershell-module.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test-powershell-module.yml b/.github/workflows/build-and-test-powershell-module.yml index 8ffa6a4..6a18427 100644 --- a/.github/workflows/build-and-test-powershell-module.yml +++ b/.github/workflows/build-and-test-powershell-module.yml @@ -160,10 +160,11 @@ jobs: Write-Output "Copying the module files to the module artifact directory '$moduleArtifactDirectoryPath', excluding tests." Copy-Item -Path $moduleDirectoryPath -Destination $moduleArtifactDirectoryPath -Exclude '*.Tests.ps1' -Recurse -Force - [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath 'TemplateRepoFiles' - [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath 'TemplateRepoFiles' - Write-Output "Copying the module template test files to the module artifact directory '$moduleArtifactTemplateFilesDirectoryPath'." - Copy-Item -Path $moduleTemplateFilesDirectoryPath\* -Destination $moduleArtifactTemplateFilesDirectoryPath -Include '*.Tests.ps1' -Recurse -Force -Container + [string] $templateFilesDirectoryName = 'TemplateRepoFiles' + [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath $templateFilesDirectoryName + [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath $templateFilesDirectoryName + Write-Output "Copying the module template repo files to the module artifact directory '$moduleArtifactTemplateFilesDirectoryPath' verbatim, to ensure test files are included." + Copy-Item -Path $moduleTemplateFilesDirectoryPath -Destination $moduleArtifactTemplateFilesDirectoryPath -Recurse -Force - name: Create deploy files artifact shell: pwsh From 14c787bc52e71bb859a400b534935de1fbb54b5d Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 24 Mar 2024 18:01:54 -0600 Subject: [PATCH 5/6] ci: Try to fix up module artifacts files --- .github/workflows/build-and-test-powershell-module.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test-powershell-module.yml b/.github/workflows/build-and-test-powershell-module.yml index 6a18427..6856a03 100644 --- a/.github/workflows/build-and-test-powershell-module.yml +++ b/.github/workflows/build-and-test-powershell-module.yml @@ -157,14 +157,12 @@ jobs: Write-Output "Testing the module manifest file '$moduleManifestFilePath' to ensure it is valid." Test-ModuleManifest -Path $moduleManifestFilePath - Write-Output "Copying the module files to the module artifact directory '$moduleArtifactDirectoryPath', excluding tests." + Write-Output "Copying the module files to the module artifact directory '$moduleArtifactDirectoryPath'." Copy-Item -Path $moduleDirectoryPath -Destination $moduleArtifactDirectoryPath -Exclude '*.Tests.ps1' -Recurse -Force - [string] $templateFilesDirectoryName = 'TemplateRepoFiles' - [string] $moduleTemplateFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath $templateFilesDirectoryName - [string] $moduleArtifactTemplateFilesDirectoryPath = Join-Path -Path $moduleArtifactDirectoryPath -ChildPath $templateFilesDirectoryName - Write-Output "Copying the module template repo files to the module artifact directory '$moduleArtifactTemplateFilesDirectoryPath' verbatim, to ensure test files are included." - Copy-Item -Path $moduleTemplateFilesDirectoryPath -Destination $moduleArtifactTemplateFilesDirectoryPath -Recurse -Force + [string] $moduleTemplateRepoFilesDirectoryPath = Join-Path -Path $moduleDirectoryPath -ChildPath 'TemplateRepoFiles' + Write-Output "Copying the module template repo files '$moduleTemplateRepoFilesDirectoryPath' to the module artifact directory '$moduleArtifactDirectoryPath' verbatim, to ensure test files are included." + Copy-Item -Path $moduleTemplateRepoFilesDirectoryPath -Destination $moduleArtifactDirectoryPath -Recurse -Force - name: Create deploy files artifact shell: pwsh From 3ca8208e0981edf7cd07c1e364844cd4716b1b6e Mon Sep 17 00:00:00 2001 From: deadlydog Date: Mon, 25 Mar 2024 08:13:22 -0600 Subject: [PATCH 6/6] test: Remove troubleshooting code --- deploy/Invoke-SmokeTests.ps1 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/deploy/Invoke-SmokeTests.ps1 b/deploy/Invoke-SmokeTests.ps1 index d0fab9c..e896882 100644 --- a/deploy/Invoke-SmokeTests.ps1 +++ b/deploy/Invoke-SmokeTests.ps1 @@ -26,12 +26,7 @@ Describe 'New-PowerShellScriptModuleRepository' { $expectedModuleTestsFilePath = Join-Path -Path $expectedModuleDirectoryPath -ChildPath "$moduleName.Tests.ps1" # Act. - New-PowerShellScriptModuleRepository -RepositoryDirectoryPath $repositoryDirectoryPath -ModuleName $moduleName -OrganizationName $organizationName -Verbose - - Write-Verbose "Module directory path: $repositoryDirectoryPath" -Verbose - $paths = Get-ChildItem -Path $repositoryDirectoryPath -Recurse | - Select-Object -ExpandProperty FullName - Write-Verbose "Paths: $paths" -Verbose + New-PowerShellScriptModuleRepository -RepositoryDirectoryPath $repositoryDirectoryPath -ModuleName $moduleName -OrganizationName $organizationName # Assert. $expectedModuleDirectoryPath | Should -Exist