Skip to content

Commit 157d1e2

Browse files
committed
github actions: fixed MSSQL installation
1 parent 0eab432 commit 157d1e2

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

.github/workflows/tests.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88

99
jobs:
1010
tests:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
1414
php: ['8.2', '8.3', '8.4', '8.5']
@@ -96,12 +96,35 @@ jobs:
9696
tools: ${{ env.php-tools }}
9797
coverage: none
9898

99+
- name: Install MS ODBC Driver for SQL Server
100+
run: |
101+
set -euxo pipefail
102+
103+
sudo apt-get update
104+
sudo apt-get install -y curl ca-certificates gnupg
105+
106+
# Microsoft apt repo key (non-interactive; fixes "gpg: cannot open /dev/tty")
107+
sudo install -d -m 0755 /etc/apt/keyrings
108+
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc \
109+
| sudo gpg --dearmor --batch --yes --no-tty -o /etc/apt/keyrings/microsoft.gpg
110+
sudo chmod a+r /etc/apt/keyrings/microsoft.gpg
111+
112+
# Microsoft apt repo for current Ubuntu runner
113+
. /etc/os-release
114+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/${VERSION_ID}/prod ${VERSION_CODENAME} main" \
115+
| sudo tee /etc/apt/sources.list.d/microsoft-prod.list > /dev/null
116+
117+
sudo apt-get update
118+
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
119+
120+
# Create DB inside the MSSQL service container
121+
docker exec -i mssql /opt/mssql-tools18/bin/sqlcmd \
122+
-S localhost -U SA -P 'YourStrong!Passw0rd' \
123+
-Q "CREATE DATABASE dibi_test" -N -C
124+
99125
- name: Create databases.ini
100126
run: cp ./tests/databases.github.ini ./tests/databases.ini
101127

102-
- name: Create MS SQL Database
103-
run: docker exec -i mssql /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE dibi_test' -N -C
104-
105128
- run: composer install --no-progress --prefer-dist
106129
- run: composer tester -- -p phpdbg --coverage ./coverage.xml --coverage-src ./src
107130
- if: failure()

0 commit comments

Comments
 (0)