In this post, let's see how you can install SQL Server Express LocalDB in GitHub Workflows. This is useful when you want to run integration tests in a Workflow.
Technically you can use this approach anywhere as long as the Agent is Windows, as this is just a set of PowerShell commands.
name: Build and deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- ...
- name: Install MSSQLLocalDB
run: |
Import-Module BitsTransfer
Start-BitsTransfer `
-Source https://download.microsoft.com/download/3/8/d/38de7036-2433-4207-8eae-06e247e17b25/SqlLocalDB.msi `
-Destination SqlLocalDB.msi
Start-Process `
-FilePath "SqlLocalDB.msi" `
-ArgumentList "/qn", "/norestart", "/l*v SqlLocalDBInstall.log", "IACCEPTSQLLOCALDBLICENSETERMS=YES"; `
-Wait
sqlcmd -l 60 -S "(LocalDb)\MSSQLLocalDB" -Q "SELECT @@VERSION;"
Jaliya