Skip to content

Commit

Permalink
Revert "ci branch filter test"
Browse files Browse the repository at this point in the history
This reverts commit dd3f788.
  • Loading branch information
jworkmanjc committed Oct 6, 2023
1 parent dd3f788 commit ed18c80
Showing 1 changed file with 147 additions and 0 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/powershell-module-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,150 @@ jobs:
- name: Filter
if: ${{contains(github.base_ref, 'PowerShellModule_**')}}
run: exit 0

# Check-Filepath-Changes:
# needs: Filter-Branch
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Check Changes in Directory
# shell: pwsh
# run: |
# # Define List of PWSH directories:
# $list = @(
# "/PowerShell/Deploy/",
# "/PowerShell/JumpCloud Module/",
# "/PowerShell/ModuleChangelog.md"
# )
# # Loop through each file in the list then do git diff
# $difCount = 0 # Diff Counter
# git fetch origin $env:GITHUB_BASE_REF
# $gitDiff = git diff origin/$env:GITHUB_BASE_REF..HEAD . ':!.github/workflows/powershell-module-ci.yml'
# foreach ($path in $list) {
# # Check if the path exists in the Git diff
# if ($gitDiff -match [regex]::Escape($path)) {
# Write-Host "Path found in Git diff: $path"
# $difCount++
# }
# }
# $gitdiff
# # If difcount = 0 then no changes were made to the files in the list, throw exit 1
# if ($difCount -eq 0) {
# Write-Host "No changes were made to the files in the list, exiting with code 1"
# exit 1
# } else {
# Write-Host "Changes were made to the files in the list"
# exit 0
# }
Validate-Env-Variables:
needs: Filter-Branch
runs-on: ubuntu-latest
steps:
- shell: pwsh
run: |
# validate release type variables
$env:OVERRIDE_VERSION | Should -BeIn @('true', 'false')
$env:RELEASE_TYPE | Should -BeIn @('major','minor','patch')
Validate-Module:
needs: Setup-Build-Dependancies
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
PowerShell
- uses: actions/cache@v3
with:
path: "/home/runner/.local/share/powershell/Modules/"
key: PS-Dependancies
- shell: pwsh
run: |
. "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -ModuleValidation
Test-Module:
needs: [Setup-Build-Dependancies, Validate-Module]
runs-on: ubuntu-latest
timeout-minutes: 75
name: Run Pester Tests and Upload Results
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
PowerShell
- uses: actions/cache@v3
with:
path: "/home/runner/.local/share/powershell/Modules/"
key: PS-Dependancies
- name: Test PWSH Module
shell: pwsh
env:
PESTER_APIKEY: ${{ secrets.PESTER_APIKEY }}
PESTER_ORGID: ${{ secrets.PESTER_ORGID }}
PESTER_MSP_APIKEY: ${{ secrets.PESTER_MSP_APIKEY }}
run: |
. "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -JumpCloudApiKey "$env:PESTER_APIKEY" -JumpCloudApiKeyMsp "$env:PESTER_MSP_APIKEY" -JumpCloudMspOrg "$env:PESTER_ORGID" -ExcludeTagList "ModuleValidation", "JCDeployment", "MSP", "JCModule", "JCAssociation" -IncludeTagList "*" -RequiredModulesRepo "PSGallery"
if: ${{ always() }}
Test-Module-MSP:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
PowerShell
- uses: actions/cache@v3
with:
path: "/home/runner/.local/share/powershell/Modules/"
key: PS-Dependancies
- shell: pwsh
env:
PESTER_APIKEY: ${{ secrets.PESTER_APIKEY }}
PESTER_ORGID: ${{ secrets.PESTER_ORGID }}
PESTER_MSP_APIKEY: ${{ secrets.PESTER_MSP_APIKEY }}
PESTER_PROVIDER_ID: ${{ secrets.PESTER_PROVIDER_ID }}
run: |
. "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -JumpCloudApiKey "$env:PESTER_APIKEY" -JumpCloudApiKeyMsp "$env:PESTER_MSP_APIKEY" -JumpCloudMspOrg "$env:PESTER_ORGID" -ExcludeTagList "None" -IncludeTagList "MSP" -RequiredModulesRepo "PSGallery"
needs: [Test-Module]

Setup-Build-Dependancies:
needs: Filter-Branch
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup PowerShell Module Cache
id: cacher
uses: actions/cache@v3
with:
path: "/home/runner/.local/share/powershell/Modules/"
key: PS-Dependancies
- name: Install dependencies
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
If (!(Get-PackageProvider -Name:('NuGet') -ListAvailable -ErrorAction:('SilentlyContinue'))) {
Write-Host ('[status]Installing package provider NuGet');
Install-PackageProvider -Name:('NuGet') -Scope:('CurrentUser') -Force
}
$PSDependencies = @{
'PowerShellGet' = @{Repository = 'PSGallery'; RequiredVersion = '3.0.12-beta' }
'PackageManagement' = @{Repository = 'PSGallery'; RequiredVersion = '1.4.8.1' }
'PSScriptAnalyzer' = @{Repository = 'PSGallery'; RequiredVersion = '1.19.1' }
'PlatyPS' = @{Repository = 'PSGallery'; RequiredVersion = '0.14.2' }
'AWS.Tools.Common' = @{Repository = 'PSGallery'; RequiredVersion = '4.1.122' }
'AWS.Tools.CodeArtifact' = @{Repository = 'PSGallery'; RequiredVersion = '4.1.122' }
'JumpCloud.SDK.V1' = @{Repository = 'PSGallery'; RequiredVersion = '0.0.35'}
'JumpCloud.SDK.V2' = @{Repository = 'PSGallery'; RequiredVersion = '0.0.39'}
'JumpCloud.SDK.DirectoryInsights' = @{Repository = 'PSGallery'; RequiredVersion = '0.0.23'}
}
foreach ($RequiredModule in $PSDependencies.Keys) {
If ([System.String]::IsNullOrEmpty((Get-InstalledModule | Where-Object { $_.Name -eq $RequiredModule }))) {
Write-Host("[status]Installing module: '$RequiredModule'; version: $($PSDependencies[$RequiredModule].RequiredVersion) from $($PSDependencies[$RequiredModule].Repository)")
Install-Module -Name $RequiredModule -Repository:($($PSDependencies[$RequiredModule].Repository)) -RequiredVersion:($($PSDependencies[$RequiredModule].RequiredVersion)) -AllowPrerelease -Force
}
}

0 comments on commit ed18c80

Please sign in to comment.