Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up and Fix Docker on Mac using Colima #22

Merged
merged 16 commits into from
Nov 17, 2022
26 changes: 22 additions & 4 deletions .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
@@ -4,24 +4,42 @@ on:

jobs:
test-everywhere:
name: Test Action on all platforms
name: Test All Platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run the action
- name: Install sqlengine
uses: ./
with:
install: sqlengine, sqlclient, sqlpackage, localdb
install: sqlengine
sa-password: c0MplicatedP@ssword
show-log: true
collation: Latin1_General_BIN

- name: Install sqlclient
uses: ./
with:
install: sqlclient
show-log: true

- name: Install sqlpackage
uses: ./
with:
install: sqlpackage
show-log: true

- name: Install localdb
uses: ./
with:
install: localdb
show-log: true

- name: Run sqlcmd
run: sqlcmd -S localhost -U sa -P c0MplicatedP@ssword -d tempdb -Q "SELECT @@version;"

4 changes: 2 additions & 2 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ on: [push]

jobs:
test-everywhere:
name: Test Action on all platforms and versions
name: Test all platforms/versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -11,7 +11,7 @@ jobs:
version: ["2017", "2019", "2022"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run the action
uses: ./
2 changes: 1 addition & 1 deletion .github/workflows/single.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run the action
uses: potatoqualitee/mssqlsuite@v1.1
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -42,10 +42,10 @@ None
| 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 | ~1.5m |
| SQL Engine | sqlengine | macOS | Docker container with SQL Server 2019 running on VirtualBox, accessible at `localhost`. Docker [not supported on macOS](https://github.community/t/why-is-docker-not-installed-on-macos/17017) in GitHub Actions. | ~5m |
| SQL Engine | sqlengine | macOS | Docker container with SQL Server 2019 accessible at `localhost`. | ~3m |
| SqlLocalDB | localdb | macOS | Not supported | N/A |
| Client Tools | sqlclient | macOS | Includes sqlcmd, bcp, and odbc drivers | ~2m |
| sqlpackage | sqlpackage | macOS | Installed from web | ~25s |
| Client Tools | sqlclient | macOS | Includes sqlcmd, bcp, and odbc drivers | ~30s |
| sqlpackage | sqlpackage | macOS | Installed from web | ~5s |

### Example workflows

@@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run the action
uses: potatoqualitee/mssqlsuite@v1.5.1
@@ -86,7 +86,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run the action
uses: potatoqualitee/mssqlsuite@v1.5.1
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -30,9 +30,10 @@ runs:
shell: pwsh
env:
ACCEPT_EULA: "Y"
HOMEBREW_ACCEPT_EULA: "Y"
HOMEBREW_NO_INSTALL_CLEANUP: "Y"
SA_PASSWORD: ${{ inputs.sa-password }}
MSSQL_AGENT_ENABLED: "true"
HOMEBREW_NO_ENV_FILTERING: "1"
run: |
Write-Output "Getting variables for suite"

38 changes: 5 additions & 33 deletions main.ps1
Original file line number Diff line number Diff line change
@@ -13,36 +13,8 @@ if ("sqlengine" -in $Install) {
if ($ismacos) {
Write-Output "mac detected, installing docker then downloading a docker container"
$Env:HOMEBREW_NO_AUTO_UPDATE = 1
brew install --cask docker
sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
open -a /Applications/Docker.app --args --unattended --accept-license
Start-Sleep 30
$tries = 0
Write-Output "We are waiting for Docker to be up and running. It can take over 2 minutes..."
do {
try {
$tries++
$sock = Get-ChildItem $home/Library/Containers/com.docker.docker/Data/docker.raw.sock -ErrorAction Stop
} catch {
Write-Output "Waiting..."
Start-Sleep 5
}
}
until ($sock.BaseName -or $tries -gt 55)

if ($tries -gt 55) {
Write-Output "



Moving on without waiting for docker to start




"
}

brew install docker
colima start --runtime docker
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$SaPassword" -e "MSSQL_COLLATION=$Collation" --name sql -p 1433:1433 --memory="2g" -d "mcr.microsoft.com/mssql/server:$Version-latest"
Write-Output "Docker finished running"
Start-Sleep 5
@@ -115,8 +87,8 @@ if ("sqlclient" -in $Install) {
if ($ismacos) {
Write-Output "Installing sqlclient tools"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
$null = brew update
$log = brew install msodbcsql17 mssql-tools
#$null = brew update
$log = brew install microsoft/mssql-release/msodbcsql17 microsoft/mssql-release/mssql-tools

if ($ShowLog) {
$log
@@ -130,7 +102,7 @@ if ("sqlpackage" -in $Install) {
Write-Output "installing sqlpackage"

if ($ismacos) {
curl "https://https://aka.ms/sqlpackage-macos" -4 -sL -o '/tmp/sqlpackage.zip'
curl "https://aka.ms/sqlpackage-macos" -4 -sL -o '/tmp/sqlpackage.zip'
$log = unzip /tmp/sqlpackage.zip -d $HOME/sqlpackage
chmod +x $HOME/sqlpackage/sqlpackage
sudo ln -sf $HOME/sqlpackage/sqlpackage /usr/local/bin