Skip to content

Commit

Permalink
Merge branch 'Dev' into fix-enrollment-platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienTschanz committed Mar 27, 2024
2 parents 07afeaa + c775c52 commit da136ee
Show file tree
Hide file tree
Showing 386 changed files with 45,945 additions and 5,069 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/ProblemWithResource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ body:
label: "Which workloads are affected"
description: The workload of the resource you are having an issue with.
options:
- "Azure Active Directory"
- "Azure Active Directory (Entra ID)"
- "Exchange Online"
- "Intune"
- "Office 365 Admin"
- "OneDrive for Business"
- "Planner"
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/Describe Resources Schemas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Describe Resources Schemas
on: [push]

jobs:
ParseSchemas:
# The type of runner that the job will run on
runs-on: windows-latest
permissions: write-all

# Only when run from the main repo
if: github.repository == 'microsoft/Microsoft365DSC'

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install Microsoft365DSC
shell: powershell
run: |
winrm quickconfig -force
$source = "./Modules/Microsoft365DSC/"
$destination = "C:\Program Files\WindowsPowerShell\Modules"
Copy-Item -Path $source -Recurse -Destination $destination -Container -Force
Update-M365DSCDependencies
- name: Configure Environment
shell: powershell
run: |
Set-ExecutionPolicy Unrestricted -Force
Get-ChildItem "C:\Program Files\WindowsPowerShell\Modules" -Recurse | Unblock-File
Set-M365DSCTelemetryOption -Enabled $false
Set-Item -Path WSMan:\localhost\MaxEnvelopeSizekb -Value 99999
- name: Generate {Create} Integration Tests from Examples
shell: powershell
run: |
Import-Module './Modules/Microsoft365DSC/Modules/M365DSCSchemaHandler.psm1'
New-M365DSCSchemaDefinition
- name: Commit File
shell: powershell
run: |
git config --local user.email "nicharl@microsoft.com"
git config --local user.name "NikCharlebois"
git add D:/a/Microsoft365DSC/Microsoft365DSC/Modules/Microsoft365DSC/SchemaDefinition.json
git pull
git commit -m "Updated Schema Definition"
git push
$SHA = git rev-parse HEAD
echo "commitid=$SHA" >> $env:GITHUB_OUTPUT
44 changes: 41 additions & 3 deletions .github/workflows/Global - Integration - AAD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ jobs:
{
throw $_
}
- name: Validating {Create} Integration Tests
shell: powershell
run: |
try
{
$Result = Test-DSCConfiguration -Detailed -Verbose -ErrorAction Stop
Expand All @@ -88,6 +90,18 @@ jobs:
{
Write-Host "All resources in the Tenant are in the Desired State"
}
try
{
# Commenting out since this is very finnicky right now and its preventing other tests from running.
# The Get-DSCConfiguration cmdlet isn't providing much value added when failing and doesn't provide
# info about what parsing issues occured.
#$Result = Get-DSCConfiguration -Verbose -ErrorAction Stop
}
catch
{
throw $_
}
- name: Generate {Update} Integration Tests from Examples
shell: powershell
run: |
Expand Down Expand Up @@ -120,7 +134,9 @@ jobs:
{
throw $_
}
- name: Validating {Update} Integration Tests
shell: powershell
run: |
try
{
$Result = Test-DSCConfiguration -Detailed -Verbose -ErrorAction Stop
Expand All @@ -146,6 +162,18 @@ jobs:
{
Write-Host "All resources in the Tenant are in the Desired State"
}
try
{
# Commenting out since this is very finnicky right now and its preventing other tests from running.
# The Get-DSCConfiguration cmdlet isn't providing much value added when failing and doesn't provide
# info about what parsing issues occured.
#$Result = Get-DSCConfiguration -Verbose -ErrorAction Stop
}
catch
{
throw $_
}
- name: Generate {Remove} Integration Tests from Examples
shell: powershell
run: |
Expand Down Expand Up @@ -178,7 +206,9 @@ jobs:
{
throw $_
}
- name: Validating {Remove} Integration Tests
shell: powershell
run: |
try
{
$Result = Test-DSCConfiguration -Detailed -Verbose -ErrorAction Stop
Expand All @@ -205,3 +235,11 @@ jobs:
Write-Host "All resources in the Tenant are in the Desired State"
}
try
{
#$Result = Get-DSCConfiguration -Verbose -ErrorAction Stop
}
catch
{
throw $_
}
4 changes: 4 additions & 0 deletions .github/workflows/PublishGitHubPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
needs: GenerateResource
runs-on: ubuntu-latest

permissions:
contents: write
pages: write

# Only when run from the main repo
if: github.repository == 'microsoft/Microsoft365DSC'

Expand Down
41 changes: 24 additions & 17 deletions .vscode/GetTestCoverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,38 @@
param(
[Parameter(Mandatory = $true)]
[string]
$UnitTestFilePath,

[Parameter(Mandatory = $true)]
[string]
$CmdletModule = (Join-Path -Path $PSScriptRoot `
-ChildPath '..\Stubs\Microsoft365.psm1' `
-Resolve)
$UnitTestFilePath
)

if ($UnitTestFilePath.EndsWith('Tests.ps1'))
{
$moduleName = 'Pester'
$minVersion = '5.5.0'

$pesterParameters = @{
Path = $unitTestFilePath
Parameters = @{
CmdletModule = $CmdletModule
}
}
$module = Get-Module -ListAvailable | Where-Object { $_.Name -eq $moduleName -and $_.Version -ge $minVersion }

if ($module -ne $null)
{
Write-Output "Module $moduleName with version greater than or equal to $minVersion found."
}
else
{
Write-Output "Module $moduleName with version greater than or equal to $minVersion not found."
Write-Output 'Please install the module using the following command:'
Write-Output "Install-Module -Name $moduleName -MinimumVersion $minVersion"
return
}

if ($UnitTestFilePath.EndsWith('Tests.ps1'))
{
$unitTest = Get-Item -Path $UnitTestFilePath
$unitTestName = "$($unitTest.Name.Split('.')[1])"

$unitTestFilePath = (Join-Path -Path $PSScriptRoot `
$coveragePath = (Join-Path -Path $PSScriptRoot `
-ChildPath "..\Modules\Microsoft365DSC\DSCResources\MSFT_$($unitTestName)\MSFT_$($unitTestName).psm1" `
-Resolve)

Invoke-Pester -Script $pesterParameters -CodeCoverage $UnitTestFilePath -Verbose
$config = New-PesterConfiguration
$config.Run.Path = $UnitTestFilePath
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.Path = $coveragePath
Invoke-Pester -Configuration $config
}
23 changes: 18 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"request": "launch",
"name": "Run current unit test",
"script": "${file}",
"args": [
"${workspaceRoot}/Tests/Unit/Stubs/Microsoft365.psm1"
],
"args": [],
"cwd": "${file}",
"createTemporaryIntegratedConsole": true
},
Expand All @@ -18,10 +16,25 @@
"name": "Get current unit test code overage",
"script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1",
"args": [
"${file}",
"${workspaceRoot}/Tests/Unit/Stubs/Microsoft365.psm1"
"${file}"
],
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Run all QA tests",
"script": "Import-Module '${workspaceRoot}/Tests/TestHarness.psm1'; $QaResults = Invoke-QualityChecksHarness ",
"args": [],
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Run all Unit Tests",
"script": "Import-Module '${workspaceRoot}/Tests/TestHarness.psm1'; $UnitResults = Invoke-TestHarness",
"args": [],
"createTemporaryIntegratedConsole": true
}
]
}
Loading

0 comments on commit da136ee

Please sign in to comment.