-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathaction.yml
More file actions
51 lines (47 loc) · 1.54 KB
/
Copy pathaction.yml
File metadata and controls
51 lines (47 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: 'Set up SQL Server on Linux'
description: 'Starts a SQL Server 2022 Docker container with SA auth and exports BASE_CS.'
inputs:
sa-password:
description: 'SA password to use for the SQL Server instance.'
required: true
image:
description: 'SQL Server Docker image to use.'
required: false
default: 'mcr.microsoft.com/mssql/server:2025-latest'
runs:
using: composite
steps:
- name: Start SQL Server container
shell: bash
env:
SA_PASSWORD: ${{ inputs.sa-password }}
MSSQL_IMAGE: ${{ inputs.image }}
run: |
docker run -d --name sqlserver \
-e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=${SA_PASSWORD}" \
-p 1433:1433 \
"$MSSQL_IMAGE"
- name: Wait for SQL Server to be ready
shell: bash
env:
SA_PASSWORD: ${{ inputs.sa-password }}
run: |
for i in $(seq 1 30); do
if docker exec sqlserver /opt/mssql-tools18/bin/sqlcmd \
-S localhost -U sa -P "${SA_PASSWORD}" -C -Q 'SELECT 1' >/dev/null 2>&1; then
echo "SQL Server is ready"
exit 0
fi
echo "Waiting for SQL Server... ($i/30)"
sleep 5
done
echo "SQL Server did not become ready in time"
docker logs sqlserver
exit 1
- name: Set connection string
shell: bash
env:
SA_PASSWORD: ${{ inputs.sa-password }}
run: |
echo "BASE_CS=Server=localhost;User ID=sa;Password=${SA_PASSWORD};TrustServerCertificate=True;" >> "$GITHUB_ENV"