-
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (67 loc) · 2.49 KB
/
Copy pathtesting-sqlserver.yml
File metadata and controls
76 lines (67 loc) · 2.49 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
on: # yamllint disable-line rule:truthy
pull_request: null
push:
branches:
- master
- main
- '*.*'
- '*.*.*'
name: 📀 SQLServer
jobs:
acceptance:
name: SQLServer · PHP ${{ matrix.php-version }}
timeout-minutes: 10
runs-on: ubuntu-latest
concurrency:
cancel-in-progress: true
group: mssql-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}
strategy:
fail-fast: false
matrix:
php-version:
- '8.2'
- '8.3'
- '8.4'
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v5
- name: 🛠️ Install ODBC driver
run: |
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list \
| sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
- name: 🛠️ Start SQLServer
run: docker compose -f tests/docker-compose.yml up -d cycle-sqlserver
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: pecl
extensions: mbstring, pdo, pdo_sqlite, sqlsrv, pdo_sqlsrv
ini-values: error_reporting=E_ALL
- name: 📥 Install dependencies with composer
uses: ramsey/composer-install@v3
with:
dependency-versions: highest
- name: ⏳ Wait for SQLServer
run: |
container=$(docker ps -qf "ancestor=mcr.microsoft.com/mssql/server:2019-latest")
for i in $(seq 1 30); do
# The image ships sqlcmd under mssql-tools18 (v18 encrypts by default, so it needs -C);
# fall back to the legacy mssql-tools path for older images.
if docker exec "$container" bash -c \
"/opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -C -Q 'SELECT 1' -b \
|| /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1' -b"; then
echo "SQLServer is up"; exit 0
fi
echo "Waiting for SQLServer... ($i)"; sleep 3
done
echo "SQLServer did not become ready in time"; exit 1
- name: 🧪 Run acceptance tests (SQLServer)
env:
DB_HOSTNAME: 127.0.0.1
DB_PORT: 11433
DB_PASSWORD: 'YourStrong!Passw0rd'
run: composer test:sqlserver