Skip to content

Commit

Permalink
test pester after artifact build
Browse files Browse the repository at this point in the history
  • Loading branch information
jworkmanjc committed Nov 8, 2023
1 parent be1670b commit 33e5fbc
Showing 1 changed file with 28 additions and 33 deletions.
61 changes: 28 additions & 33 deletions .github/workflows/jcapi-powershell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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) {
Expand All @@ -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')

0 comments on commit 33e5fbc

Please sign in to comment.