Skip to content

Commit 76ed8c1

Browse files
vkuttypCopilot
andcommitted
fix: install sqlcmd before using it in MSSQL CI job
- Install mssql-tools18 via apt so sqlcmd is available on PATH - Add 3-minute timeout and explicit retry loop (30 × 5s) with clear output - Use IF DB_ID() IS NULL to avoid error if DB already exists - Fix release name: sql-nio → CosmoSQLClient Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 85a9f89 commit 76ed8c1

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,25 @@ jobs:
109109
swift-version: "6.0"
110110
- name: Install SQLite
111111
run: sudo apt-get install -y libsqlite3-dev
112+
- name: Install sqlcmd
113+
run: |
114+
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg
115+
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/24.04/prod noble main" \
116+
| sudo tee /etc/apt/sources.list.d/mssql-tools.list
117+
sudo apt-get update -q
118+
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18 unixodbc-dev
119+
echo "/opt/mssql-tools18/bin" >> "$GITHUB_PATH"
112120
- name: Create test database
121+
timeout-minutes: 3
113122
run: |
114-
until /opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 'SuperStr0ngP@ssword!' -C \
115-
-Q "CREATE DATABASE MSSQLNioTestDb" 2>/dev/null; do
116-
echo "Waiting for SQL Server..."; sleep 3
123+
for i in $(seq 1 30); do
124+
if sqlcmd -S 127.0.0.1 -U sa -P 'SuperStr0ngP@ssword!' -C \
125+
-Q "IF DB_ID('MSSQLNioTestDb') IS NULL CREATE DATABASE MSSQLNioTestDb" 2>/dev/null; then
126+
echo "Database ready."
127+
break
128+
fi
129+
echo "Attempt $i: SQL Server not ready yet, retrying in 5s..."
130+
sleep 5
117131
done
118132
- name: Run MSSQL tests
119133
env:
@@ -200,7 +214,7 @@ jobs:
200214
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201215
with:
202216
tag_name: ${{ steps.version.outputs.tag }}
203-
release_name: sql-nio ${{ steps.version.outputs.tag }}
217+
release_name: CosmoSQLClient ${{ steps.version.outputs.tag }}
204218
body: ${{ steps.changelog.outputs.body }}
205219
draft: false
206220
prerelease: ${{ steps.version.outputs.prerelease }}

0 commit comments

Comments
 (0)