This GitHub Action automatically installs a SQL Server suite of tools including sqlcmd, bcp, sqlpackage, the sql engine, localdb and more for Windows, macOS and Linux.
Just copy the code below and modify the line install: sqlengine, sqlclient, sqlpackage, localdb, fulltext
with the options you need.
- name: Install a SQL Server suite of tools
uses: potatoqualitee/[email protected]
with:
install: sqlengine, sqlclient, sqlpackage, localdb, fulltext
Create a workflow .yml
file in your repositories .github/workflows
directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.
install
- The apps to install. Options include:sqlengine
,sqlclient
,sqlpackage
,localdb
, andfulltext
sa-password
- The sa password for the SQL instance. The default isdbatools.I0
collation
- Change the collation associated with the SQL Server instanceversion
- The version of SQL Server to install in year format. Options are 2019 and 2022 (defaults to 2022)show-log
- Show logs, including docker logs, for troubleshooting
None
Application | Keyword | OS | Details | Time |
---|---|---|---|---|
SQL Engine | sqlengine | Linux | Docker container with SQL Server 2022, accessible at localhost |
~30s |
SqlLocalDB | localdb | Linux | Not supported | N/A |
Client Tools | sqlclient | Linux | Includes sqlcmd, bcp, and odbc drivers | ~15s |
sqlpackage | sqlpackage | Linux | Installed from web | ~5s |
Full-Text Search | fulltext | Linux | Installed using apt-get | ~45s |
SQL Engine | sqlengine | Windows | Full install of SQL Server 2022, accessible at localhost . Docker took like 15 minutes. Windows and SQL authentication both supported. |
~3m |
SqlLocalDB | localdb | Windows | Accessible at (localdb)\MSSQLLocalDB |
~30s |
Client Tools | sqlclient | Windows | Already included in runner, including sqlcmd, bcp, and odbc drivers | N/A |
sqlpackage | sqlpackage | Windows | Installed using chocolatey | ~20s |
Full-Text Search | fulltext | Windows | Enabled during SQL Engine install | ~1m |
SQL Engine | sqlengine | macOS | Docker container with SQL Server 2022 accessible at localhost . |
~7m |
SqlLocalDB | localdb | macOS | Not supported | N/A |
Client Tools | sqlclient | macOS | Includes sqlcmd, bcp, and odbc drivers | ~20s |
sqlpackage | sqlpackage | macOS | Installed from web | ~5s |
Full-Text Search | fulltext | macOS | Installed using apt-get | ~5m |
Create a SQL Server 2022 container and sqlpackage on Linux (the fastest runner, by far)
on: [push]
jobs:
test-everywhere:
name: Test Action on all platforms
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run the action
uses: potatoqualitee/[email protected]
with:
install: sqlengine, sqlpackage
- name: Run sqlclient
run: sqlcmd -S localhost -U sa -P dbatools.I0 -d tempdb -Q "SELECT @@version;" -C
Installing everything on all OSes, plus using a different sa password and collation
on: [push]
jobs:
test-everywhere:
name: Test Action on all platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
- name: Run the action
uses: potatoqualitee/[email protected]
with:
install: sqlengine, sqlclient, sqlpackage, localdb, fulltext
version: 2019
sa-password: c0MplicatedP@ssword
show-log: true
collation: Latin1_General_BIN
- name: Run sqlcmd
run: sqlcmd -S localhost -U sa -P c0MplicatedP@ssword -d tempdb -Q "SELECT @@version;" -C
Pull requests are welcome!
- MacOS: Migrate docker from qemu to vz to speed up the process.
- Wait for GitHub Actions to support more stuff to make the install sleeker.
- Maybe more tools from here.
- mssql-cli (command-line query tool)
- osql
- SQLdiag
- sqlmaint
- sqllogship
- tablediff
The scripts and documentation in this project are released under the MIT License
The SqlServer
PowerShell module is included on the Windows runner. You can find more information about what's installed on GitHub runners on their docs page.