From 33e5fbcd891b94238bffcdf314ad665ece9a3e71 Mon Sep 17 00:00:00 2001 From: Joe Workman Date: Wed, 8 Nov 2023 13:17:58 -0700 Subject: [PATCH] test pester after artifact build --- .github/workflows/jcapi-powershell-ci.yml | 61 +++++++++++------------ 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/.github/workflows/jcapi-powershell-ci.yml b/.github/workflows/jcapi-powershell-ci.yml index 9ff07adc9..9eb7ba504 100644 --- a/.github/workflows/jcapi-powershell-ci.yml +++ b/.github/workflows/jcapi-powershell-ci.yml @@ -162,7 +162,7 @@ jobs: $ErrorActionnPreference = 'Stop' ./Test-Module.ps1 -JCApiKey:($env:PESTER_APIKEY) -JCOrgId:($env:PESTER_ORGID) -JCApiKeyMTP:($env:PESTER_MSP_APIKEY) -JCProviderId:($env:PESTER_PROVIDERID) -ExcludeTagList:("None") -IncludeTagList:("MTP") -testModulePath:("./SDKs/PowerShell/${{ matrix.SDKName }}/test-module.ps1") Invoke-Pester: - needs: ["Setup-Build-Dependancies"] + needs: ["Setup-Build-Dependancies", "Build-SDK"] runs-on: ubuntu-latest timeout-minutes: 70 steps: @@ -176,24 +176,24 @@ jobs: with: path: "/home/runner/.local/share/powershell/Modules/" key: PS-Dependancies - # - uses: actions/download-artifact@v3 - # with: - # name: build-JumpCloud.SDK.DirectoryInsights - # path: /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ - # - uses: actions/download-artifact@v3 - # with: - # name: build-JumpCloud.SDK.V1 - # path: /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ - # - uses: actions/download-artifact@v3 - # with: - # name: build-JumpCloud.SDK.V2 - # path: /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ - # - name: Unzip artifacts - # shell: pwsh - # run: | - # Expand-Archive -Path /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights.zip -DestinationPath /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ -Force - # Expand-Archive -Path /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/JumpCloud.SDK.V1.zip -DestinationPath /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ -Force - # Expand-Archive -Path /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/JumpCloud.SDK.V2.zip -DestinationPath /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ -Force + - uses: actions/download-artifact@v3 + with: + name: build-JumpCloud.SDK.DirectoryInsights + path: /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ + - uses: actions/download-artifact@v3 + with: + name: build-JumpCloud.SDK.V1 + path: /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ + - uses: actions/download-artifact@v3 + with: + name: build-JumpCloud.SDK.V2 + path: /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ + - name: Unzip artifacts + shell: pwsh + run: | + Expand-Archive -Path /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights.zip -DestinationPath /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ -Force + Expand-Archive -Path /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/JumpCloud.SDK.V1.zip -DestinationPath /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ -Force + Expand-Archive -Path /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/JumpCloud.SDK.V2.zip -DestinationPath /home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/ -Force - name: Invoke Pester shell: pwsh env: @@ -202,26 +202,19 @@ jobs: PESTER_MSP_APIKEY: ${{ secrets.PESTER_MSP_APIKEY }} PESTER_PROVIDERID: ${{ secrets.PESTER_PROVIDERID }} run: | - # Import all the SDKs - # $sdks = @('JumpCloud.SDK.DirectoryInsights', 'JumpCloud.SDK.V1', 'JumpCloud.SDK.V2') - # foreach ($sdk in $sdks){ - # Import-Module "/home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/$sdk/$sdk.psd1" -force - # } - # print tree path - # tree $ErrorActionPreference = 'stop' - # . /home/runner/work/support/support/PowerShell/Deploy/SdkSync/jcapiToSupportSync.ps1 -RequiredModulesRepo CodeArtifact - # Get functions where 'jcsdk' functions are found - # Private & Public Functions - # print directory paths: - gci ./ -Directory - + # Import all the SDKs + $sdks = @('JumpCloud.SDK.DirectoryInsights', 'JumpCloud.SDK.V1', 'JumpCloud.SDK.V2') + foreach ($sdk in $sdks){ + Import-Module "/home/runner/work/jcapi-powershell/jcapi-powershell/SDKs/PowerShell/$sdk/$sdk.psd1" -force + } + # Get functions from module: $pathList = @('Private', 'Public') # Get matching functions - $functions = $pathList | ForEach-Object { Get-ChildItem "./support/PowerShell/JumpCloud Module/$($_)/*.ps1" -Recurse } + # Get Tags with SDK functions: $testTags = @() # For each function file foreach ($file in $functions) { @@ -244,6 +237,8 @@ jobs: # Manually add tags that we can't automatically add with script above: # At this time only associations need to be added: $tags += 'JCAssociation' + # setup org: + . ("./PowerShell/JumpCloud Module/Tests/SetupOrg.ps1") -JumpCloudApiKey "$env:PESTER_APIKEY" -JumpCloudApiKeyMsp "$env:PESTER_MSP_APIKEY" # Invoke Pester . "./support/PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -JumpCloudApiKey $env:PESTER_APIKEY -ExcludeTagList:('MSP') -IncludeTagList:($tags) -RequiredModulesRepo:('PSGallery')