Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/Build and Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Test

on:
pull_request:
branches:
- dev
- master

jobs:
build:
runs-on: windows-latest

permissions: write-all

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

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Modules
shell: pwsh
run: |
Install-PSResource -Name Pester -Scope AllUsers -TrustRepository

- name: Run Pester Tests
shell: pwsh
run: |
$results = Invoke-Pester -Path .\Tests\ReverseDSC.Core.Tests.ps1 -CI -PassThru
if ($results.FailedCount -gt 0)
{
throw "{$($results.FailedCount)} Unit Test(s) Failed"
}

- name: Validate Module Manifest
shell: pwsh
run: |
Test-ModuleManifest -Path ./ReverseDSC.psd1

- name: Validate Module Import
shell: pwsh
run: |
Import-Module ./ReverseDSC.psd1 -Force -ErrorAction Stop
$exportedFunctions = (Get-Module ReverseDSC).ExportedFunctions.Keys
if ($exportedFunctions.Count -eq 0)
{
throw "No functions exported from the ReverseDSC module."
}
Write-Host "Exported functions: $($exportedFunctions -join ', ')"
37 changes: 37 additions & 0 deletions .github/workflows/PublishToGallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish to PowerShell Gallery

on:
push:
branches:
- master

jobs:
PublishToGallery:
runs-on: windows-latest

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

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Prepare ReverseDSC Module for Publishing
shell: pwsh
run: |
# Copy the ReverseDSC module to the root of the repository for publishing
New-Item -Path "./ReverseDSC" -ItemType Directory -Force
Copy-Item -Path "./ReverseDSC.psd1" -Destination "./ReverseDSC" -Force
Copy-Item -Path "./ReverseDSC.Core.psm1" -Destination "./ReverseDSC" -Force

- name: Validate Module Manifest
shell: pwsh
run: |
Test-ModuleManifest -Path ./ReverseDSC/ReverseDSC.psd1

- name: Publish
shell: pwsh
env:
PUBLIC_NUGETAPIKEY: ${{ secrets.NUGETAPIKEY }}
run: |
Publish-Module -Path "./ReverseDSC/" -NugetAPIKey $env:PUBLIC_NUGETAPIKEY
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*.user
*.userosscache
*.sln.docstates
ReverseDSC/
testResults.xml

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
Loading
Loading