-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (108 loc) · 3.62 KB
/
Copy pathsql-server-integration.yml
File metadata and controls
127 lines (108 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: SQL Server integration
on:
pull_request:
branches:
- main
paths:
- .github/workflows/sql-server-integration.yml
- .env.example
- docker-compose.yml
- scripts/**
- sql/**
push:
branches:
- main
paths:
- .github/workflows/sql-server-integration.yml
- .env.example
- docker-compose.yml
- scripts/**
- sql/**
workflow_dispatch:
permissions:
contents: read
concurrency:
group: sql-server-integration-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sql-server-integration:
name: Provision, verify, and repeat
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Show runner tool versions
shell: pwsh
run: |
Write-Host "PowerShell: $($PSVersionTable.PSVersion)"
Write-Host "Docker server: $(docker version --format '{{.Server.Version}}')"
docker compose version
- name: Validate PowerShell syntax
shell: pwsh
run: |
$parseFailed = $false
Get-ChildItem -LiteralPath ./scripts -Filter *.ps1 | ForEach-Object {
$tokens = $null
$parseErrors = $null
[System.Management.Automation.Language.Parser]::ParseFile(
$_.FullName,
[ref]$tokens,
[ref]$parseErrors
) | Out-Null
if ($parseErrors.Count -gt 0) {
$parseFailed = $true
Write-Error "Syntax error in $($_.Name): $($parseErrors.Message -join '; ')"
}
else {
Write-Host "OK: $($_.Name)"
}
}
if ($parseFailed) {
throw 'At least one PowerShell script contains a syntax error.'
}
- name: Create temporary CI configuration
shell: pwsh
run: |
$ciPassword = "Ci9!$([guid]::NewGuid().ToString('N'))"
@(
"MSSQL_SA_PASSWORD=$ciPassword"
'MSSQL_PID=Developer'
'MSSQL_PORT=14333'
'MSSQL_IMAGE=mcr.microsoft.com/mssql/server:2022-CU26-ubuntu-22.04'
) | Set-Content -LiteralPath ./.env -Encoding utf8NoBOM
- name: Run complete workflow on a fresh runner
shell: pwsh
run: |
& ./scripts/Initialize-Lab.ps1 -TimeoutSeconds 300
- name: Run complete workflow again for repeatability
shell: pwsh
run: |
& ./scripts/Initialize-Lab.ps1 -TimeoutSeconds 300 -SkipImagePull
- name: Write validation summary
shell: pwsh
run: |
@'
## SQL Server integration result
- PowerShell syntax validation: passed
- Fresh SQL Server provisioning: passed
- Relational integrity suite: passed
- Dimensional reporting reconciliation: passed
- Second complete run for repeatability: passed
'@ | Add-Content -LiteralPath $env:GITHUB_STEP_SUMMARY
- name: Show SQL Server diagnostics on failure
if: failure()
shell: bash
run: |
docker compose --env-file .env -f docker-compose.yml ps --all || true
docker compose --env-file .env -f docker-compose.yml logs --tail 200 sqlserver || true
- name: Clean up CI containers
if: always()
shell: bash
run: |
if [[ -f .env ]]; then
docker compose --env-file .env -f docker-compose.yml down --remove-orphans || true
fi
rm -f .env