Skip to content

Commit 513ccf0

Browse files
committed
Add GitHub Copilot setup workflow for development environment
1 parent 1b3ea84 commit 513ccf0

File tree

2 files changed

+197
-0
lines changed

2 files changed

+197
-0
lines changed
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: GitHub Copilot Setup Steps
2+
3+
# This workflow sets up a complete development environment for the SqlServerDsc PowerShell DSC module project
4+
# when executed by GitHub Copilot Agent for development assistance.
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
skip_tests:
10+
description: 'Skip running tests during setup'
11+
required: false
12+
default: true
13+
type: boolean
14+
15+
# cSpell: ignore pwsh cmdlets DSCResources nupkg HQRM SqlServerDsc dotnet gitversion
16+
jobs:
17+
setup-development-environment:
18+
name: Setup SqlServerDsc Development Environment
19+
runs-on: windows-latest
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # Full history needed for GitVersion
25+
26+
- name: Setup PowerShell Environment
27+
shell: pwsh
28+
run: |
29+
Write-Host "Setting up PowerShell environment..." -ForegroundColor Green
30+
31+
# Install dependent PowerShell modules
32+
Install-PSResource -Name 'SqlServer' -Version '21.1.18256' -Scope 'CurrentUser' -Repository 'PSGallery' -TrustRepository
33+
34+
# Set execution policy for development
35+
Set-ExecutionPolicy -ExecutionPolicy 'RemoteSigned' -Scope 'CurrentUser' -Force
36+
37+
Write-Host "PowerShell environment setup complete." -ForegroundColor Green
38+
39+
- name: Install .NET Tools
40+
shell: pwsh
41+
run: |
42+
Write-Host "Installing .NET tools..." -ForegroundColor Green
43+
44+
# Install GitVersion for semantic versioning
45+
dotnet tool install --global GitVersion.Tool --version 5.*
46+
47+
# Verify installation
48+
dotnet-gitversion --version
49+
50+
Write-Host ".NET tools installation complete." -ForegroundColor Green
51+
52+
- name: Verify GitVersion
53+
shell: pwsh
54+
run: |
55+
Write-Host "Running GitVersion to determine semantic version..." -ForegroundColor Green
56+
dotnet-gitversion | ConvertFrom-Json
57+
58+
- name: Resolve Dependencies
59+
shell: pwsh
60+
run: |
61+
Write-Host "Resolving project dependencies..." -ForegroundColor Green
62+
63+
# Run dependency resolution
64+
.\build.ps1 -ResolveDependency -Tasks 'noop' -ErrorAction Stop
65+
66+
Write-Host "Dependencies resolved successfully." -ForegroundColor Green
67+
68+
- name: Build Module
69+
shell: pwsh
70+
run: |
71+
Write-Host "Building SqlServerDsc module..." -ForegroundColor Green
72+
73+
# Build the module
74+
.\build.ps1 -Tasks 'build' -ErrorAction Stop
75+
76+
# Verify build output
77+
if (Test-Path -Path "output\builtModule\SqlServerDsc") {
78+
Write-Host "Module built successfully at: output\builtModule\SqlServerDsc" -ForegroundColor Green
79+
Get-ChildItem -Path "output\builtModule\SqlServerDsc" -Recurse | Select-Object Name, Length | Format-Table
80+
} else {
81+
Write-Error "Module build failed - output directory not found"
82+
exit 1
83+
}
84+
85+
- name: Import Built Module
86+
shell: pwsh
87+
run: |
88+
Write-Host "Importing built SqlServerDsc module..." -ForegroundColor Green
89+
90+
.\build.ps1 -Tasks 'noop'
91+
Import-Module -Name 'SqlServerDsc' -Force
92+
93+
# Verify module is loaded
94+
$module = Get-Module -Name SqlServerDsc
95+
if ($module) {
96+
Write-Host "Module imported successfully:" -ForegroundColor Green
97+
Write-Host " Name: $($module.Name)" -ForegroundColor Cyan
98+
Write-Host " Version: $($module.Version)" -ForegroundColor Cyan
99+
Write-Host " Path: $($module.Path)" -ForegroundColor Cyan
100+
101+
# Show available commands and resources
102+
$commands = Get-Command -Module SqlServerDsc
103+
Write-Host " Exported Commands: $($commands.Count)" -ForegroundColor Cyan
104+
105+
$dscResources = Get-DscResource -Module SqlServerDsc
106+
Write-Host " DSC Resources: $($dscResources.Count)" -ForegroundColor Cyan
107+
} else {
108+
Write-Error "Failed to import module"
109+
exit 1
110+
}
111+
112+
- name: Run QA & Unit Tests (Optional)
113+
if: ${{ inputs.skip_tests != 'true' }}
114+
shell: pwsh
115+
run: |
116+
Write-Host "Running QA & unit tests..." -ForegroundColor Green
117+
118+
# Run QA & unit tests only (skip integration tests in setup)
119+
.\build.ps1 -Tasks 'test' -PesterPath 'tests\Unit', 'tests\QA'
120+
121+
Write-Host "QA & unit tests completed." -ForegroundColor Green
122+
123+
# - name: Validate Project Structure
124+
# shell: pwsh
125+
# run: |
126+
# Write-Host "Validating project structure..." -ForegroundColor Green
127+
128+
# $requiredPaths = @(
129+
# 'source\Classes',
130+
# 'source\Public',
131+
# 'source\Private',
132+
# 'source\DSCResources',
133+
# 'source\en-US',
134+
# 'tests\Unit',
135+
# 'tests\Integration',
136+
# 'build.ps1',
137+
# 'build.yaml',
138+
# 'RequiredModules.psd1'
139+
# )
140+
141+
# $missingPaths = @()
142+
# foreach ($path in $requiredPaths) {
143+
# if (-not (Test-Path -Path $path)) {
144+
# $missingPaths += $path
145+
# } else {
146+
# Write-Host "✓ $path" -ForegroundColor Green
147+
# }
148+
# }
149+
150+
# if ($missingPaths.Count -gt 0) {
151+
# Write-Warning "Missing expected project paths:"
152+
# $missingPaths | ForEach-Object { Write-Host " ✗ $_" -ForegroundColor Red }
153+
# } else {
154+
# Write-Host "All expected project paths found." -ForegroundColor Green
155+
# }
156+
157+
- name: Setup Complete - Display Environment Info
158+
shell: pwsh
159+
run: |
160+
Write-Host ""
161+
Write-Host "=========================================" -ForegroundColor Green
162+
Write-Host "SqlServerDsc Development Environment Ready!" -ForegroundColor Green
163+
Write-Host "=========================================" -ForegroundColor Green
164+
Write-Host ""
165+
Write-Host "Project Information:" -ForegroundColor Cyan
166+
Write-Host " Repository: SqlServerDsc PowerShell DSC Module" -ForegroundColor White
167+
Write-Host " Type: Class-based DSC resources for SQL Server" -ForegroundColor White
168+
Write-Host " Framework: Sampler + ModuleBuilder" -ForegroundColor White
169+
Write-Host " Testing: Pester v5 framework" -ForegroundColor White
170+
Write-Host ""
171+
Write-Host "Available Build Commands:" -ForegroundColor Cyan
172+
Write-Host " .\build.ps1 -Tasks build # Build module" -ForegroundColor White
173+
Write-Host " .\build.ps1 -Tasks test # Run all tests" -ForegroundColor White
174+
Write-Host " .\build.ps1 -Tasks docs # Generate documentation" -ForegroundColor White
175+
Write-Host " .\build.ps1 -Tasks clean # Clean output" -ForegroundColor White
176+
Write-Host ""
177+
Write-Host "Key Directories:" -ForegroundColor Cyan
178+
Write-Host " source\Classes\ # DSC class-based resources" -ForegroundColor White
179+
Write-Host " source\Public\ # Public PowerShell commands" -ForegroundColor White
180+
Write-Host " source\Private\ # Private helper functions" -ForegroundColor White
181+
Write-Host " tests\Unit\ # Unit tests (Pester v5)" -ForegroundColor White
182+
Write-Host " tests\Integration\ # Integration tests" -ForegroundColor White
183+
Write-Host " output\builtModule\ # Built module output" -ForegroundColor White
184+
Write-Host ""
185+
Write-Host "Development Guidelines:" -ForegroundColor Cyan
186+
Write-Host " • Follow DSC Community style guidelines" -ForegroundColor White
187+
Write-Host " • Use PascalCase for functions, camelCase for variables" -ForegroundColor White
188+
Write-Host " • Inherit DSC resources from ResourceBase or SqlResourceBase" -ForegroundColor White
189+
Write-Host " • Include comment-based help for all functions" -ForegroundColor White
190+
Write-Host " • Add unit tests for all new code" -ForegroundColor White
191+
Write-Host " • Use localized strings for user messages" -ForegroundColor White
192+
Write-Host ""
193+
Write-Host "Ready for development! 🚀" -ForegroundColor Green

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
### Added
9+
10+
- Added setup workflow for GitHub Copilot.
11+
812
### Changed
913

1014
- `azure-pipelines.yml`

0 commit comments

Comments
 (0)