Skip to content

Commit 1cc219d

Browse files
committed
sqlexpress for sqlauth
1 parent f2d9d6d commit 1cc219d

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,31 @@ jobs:
7373
-Q "ALTER LOGIN sa WITH PASSWORD='${SA_PASSWORD}'"
7474
echo "BASE_CS=Server=localhost;User ID=sa;Password=${SA_PASSWORD};TrustServerCertificate=True;" >> "$GITHUB_ENV"
7575
76-
# --- Windows setup: install SqlLocalDB via Chocolatey, Integrated Security ---
76+
# --- Windows setup: install SQL Server Express with SQL auth ---
7777

78-
- name: Install SqlLocalDB (Windows)
78+
- name: Generate SA password (Windows)
79+
if: runner.os == 'Windows'
80+
run: |
81+
SA_PASSWORD="$(openssl rand -base64 18 | tr -d '/+=')Aa1!"
82+
echo "::add-mask::${SA_PASSWORD}"
83+
echo "SA_PASSWORD=${SA_PASSWORD}" >> "$GITHUB_ENV"
84+
85+
- name: Install SQL Server Express (Windows)
7986
if: runner.os == 'Windows'
8087
shell: pwsh
8188
run: |
82-
choco install sqllocaldb -y --no-progress
83-
# Refresh PATH so SqlLocalDB.exe is reachable
84-
$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' +
85-
[System.Environment]::GetEnvironmentVariable('Path','User')
86-
SqlLocalDB.exe info
87-
SqlLocalDB.exe start MSSQLLocalDB
88-
SqlLocalDB.exe info MSSQLLocalDB
89+
choco install sql-server-express -y --no-progress `
90+
--params "/SECURITYMODE=SQL /SAPWD=$env:SA_PASSWORD /TCPENABLED=1"
91+
# SQL Server Browser helps named-instance resolution; not strictly required when using a port
92+
Set-Service -Name SQLBrowser -StartupType Manual -ErrorAction SilentlyContinue
93+
Start-Service -Name SQLBrowser -ErrorAction SilentlyContinue
94+
# Confirm the engine service is running
95+
Get-Service | Where-Object { $_.Name -like 'MSSQL*' } | Format-Table
8996
9097
- name: Set connection string (Windows)
9198
if: runner.os == 'Windows'
9299
run: |
93-
# LocalDB uses a named-pipe instance; Integrated Security authenticates as the runner's local user
94-
echo 'BASE_CS=Server=(localdb)\MSSQLLocalDB;Integrated Security=True;TrustServerCertificate=True;' >> "$GITHUB_ENV"
100+
echo "BASE_CS=Server=localhost\SQLEXPRESS;User ID=sa;Password=${SA_PASSWORD};TrustServerCertificate=True;" >> "$GITHUB_ENV"
95101
96102
# --- Common build and test steps ---
97103

0 commit comments

Comments
 (0)