-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code cleanup, refactor for PHP 8 compatibility, and bug fixes discove…
…red in doing so - bug fixes, prior to PHP 8, `**@**` silenced errors which this library used to return `**false**` instead, that is not no longer possible with PHP 8 - Linux and Windows CI tests move to GitHub Actions - General code style fixes - merged bug fix #199 - fixed tests in issue #200, and corrections for PR #201
- Loading branch information
1 parent
66e82e6
commit f50139f
Showing
28 changed files
with
495 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash -e | ||
|
||
# Use the following variables to control your install: | ||
|
||
# Password for the SA user (required) | ||
MSSQL_SA_PASSWORD='!Passw0rd' | ||
|
||
# Product ID of the version of SQL server you're installing | ||
# Must be evaluation, developer, express, web, standard, enterprise, or your 25 digit product key | ||
# Defaults to developer | ||
MSSQL_PID='evaluation' | ||
|
||
# Install SQL Server Agent (recommended) | ||
SQL_INSTALL_AGENT='y' | ||
|
||
# Install SQL Server Full Text Search (optional) | ||
# SQL_INSTALL_FULLTEXT='y' | ||
|
||
# Create an additional user with sysadmin privileges (optional) | ||
SQL_INSTALL_USER='ez_test' | ||
SQL_INSTALL_USER_PASSWORD='ezTest' | ||
SQL_INSTALL_DATABASE='ez_test' | ||
|
||
if [ -z $MSSQL_SA_PASSWORD ] | ||
then | ||
echo Environment variable MSSQL_SA_PASSWORD must be set for unattended install | ||
exit 1 | ||
fi | ||
|
||
echo Adding Microsoft repositories... | ||
sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | ||
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | ||
repoargs="$(curl https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)" | ||
sudo add-apt-repository "${repoargs}" | ||
|
||
echo Running apt-get update -y... | ||
sudo apt-get update -y | ||
|
||
echo Installing SQL Server... | ||
sudo apt-get install -y mssql-server | ||
|
||
echo Running mssql-conf setup... | ||
sudo MSSQL_SA_PASSWORD=$MSSQL_SA_PASSWORD \ | ||
MSSQL_PID=$MSSQL_PID \ | ||
/opt/mssql/bin/mssql-conf -n setup accept-eula | ||
|
||
# Configure firewall to allow TCP port 1433: | ||
echo Configuring UFW to allow traffic on port 1433... | ||
sudo ufw allow 1433/tcp | ||
sudo ufw reload | ||
|
||
# Restart SQL Server after installing: | ||
echo Restarting SQL Server... | ||
sudo systemctl restart mssql-server | ||
|
||
# Optional new user creation: | ||
if [ ! -z $SQL_INSTALL_USER ] && [ ! -z $SQL_INSTALL_USER_PASSWORD ] | ||
then | ||
echo Creating user $SQL_INSTALL_USER | ||
sqlcmd \ | ||
-S localhost \ | ||
-U SA \ | ||
-P $MSSQL_SA_PASSWORD \ | ||
-Q "CREATE DATABASE ez_test" | ||
sqlcmd \ | ||
-S localhost \ | ||
-U SA \ | ||
-P $MSSQL_SA_PASSWORD \ | ||
-Q "CREATE LOGIN [$SQL_INSTALL_USER] WITH PASSWORD=N'$SQL_INSTALL_USER_PASSWORD', DEFAULT_DATABASE=[$SQL_INSTALL_DATABASE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; ALTER SERVER ROLE [sysadmin] ADD MEMBER [$SQL_INSTALL_USER]" | ||
fi | ||
|
||
echo Done! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# GitHub Action for PHP with extensions | ||
name: Linux | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
linux: | ||
name: Linux (PHP ${{ matrix.php-versions }} CI) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: ['7.4', '8.0'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, fileinfo, mysqli, pdo_mysql, pgsql, pdo_pgsql, sqlite3, pdo_sqlite, sqlsrv, pdo_sqlsrv, xdebug | ||
coverage: xdebug | ||
- name: Start MySQL | ||
run: sudo systemctl start mysql.service | ||
- name: Setup MySQL Database | ||
run: | | ||
mysql -uroot -h127.0.0.1 -proot -e "CREATE DATABASE IF NOT EXISTS ez_test;" | ||
mysql -uroot -h127.0.0.1 -proot -e "CREATE USER ez_test@localhost IDENTIFIED BY 'ezTest'; GRANT ALL ON ez_test.* TO ez_test@localhost; FLUSH PRIVILEGES;" | ||
- name: Start PostgreSql | ||
run: | | ||
sudo systemctl start postgresql.service | ||
pg_isready | ||
- name: Create additional user | ||
run: | | ||
sudo -u postgres psql --command="CREATE USER ez_test PASSWORD 'ezTest'" --command="\du" | ||
- name: Setup PostgreSql Database | ||
run: | | ||
sudo -u postgres createdb --owner=ez_test ez_test | ||
- name: Setup SQLServer Database | ||
run: | | ||
chmod +x "${GITHUB_WORKSPACE}/.github/install_mssql.sh" | ||
"${GITHUB_WORKSPACE}/.github/install_mssql.sh" | ||
- name: Install dependencies | ||
run: composer update | ||
- name: Test with phpunit | ||
run: vendor/bin/phpunit --coverage-clover=coverage.xml | ||
- name: Submit code coverage | ||
run: bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# GitHub Action for PHP with extensions | ||
name: Windows | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
windows: | ||
name: Windows (PHP ${{ matrix.php-versions }} CI) | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [windows-latest] | ||
php-versions: ['7.1', '7.2'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, fileinfo, mysqli, pdo_mysql, pgsql, pdo_pgsql, sqlite3, pdo_sqlite, sqlsrv, pdo_sqlsrv, xdebug | ||
coverage: xdebug | ||
- name: Chocolatey Install MySQL | ||
run: choco install mysql --version=5.7.18 -y -f | ||
- name: Setup MySQL Database | ||
run: | | ||
mysql -u root -e "CREATE DATABASE IF NOT EXISTS ez_test;" | ||
mysql -u root -e "CREATE USER ez_test@localhost IDENTIFIED BY 'ezTest'; GRANT ALL ON ez_test.* TO ez_test@localhost; FLUSH PRIVILEGES;" | ||
- name: Chocolatey Uninstall PostgreSql 13 | ||
run: choco uninstall postgresql13 -y -f | ||
- name: Chocolatey Install PostgreSql 9 | ||
run: choco install postgresql9 --params '/Password:root' -y -f | ||
- name: Setup PostgreSql Database | ||
run: | | ||
$env:Path += ";C:\Program Files\PostgreSQL\9.6\bin" | ||
$env:PGPASSWORD = "root" | ||
psql -U postgres --command="\conninfo" | ||
psql -U postgres -c "CREATE USER ez_test WITH PASSWORD 'ezTest';" --command="\du" | ||
createdb --owner=ez_test ez_test | ||
[Environment]::SetEnvironmentVariable("Path", $env:Path, [EnvironmentVariableTarget]::Machine) | ||
- name: Chocolatey Install SQLServer | ||
run: choco install sql-server-express -ia "/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /UPDATEENABLED=FALSE /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=Password12!" -o -y -f | ||
- name: Setup SQLServer Database | ||
run: | | ||
sqlcmd -L | ||
New-NetFirewallRule -DisplayName "SQLServer default instance" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow | ||
New-NetFirewallRule -DisplayName "SQLServer Browser service" -Direction Inbound -LocalPort 1434 -Protocol UDP -Action Allow | ||
sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE ez_test" | ||
sqlcmd -S localhost,1433 -U sa -P Password12! -d ez_test -Q "CREATE LOGIN ez_test WITH PASSWORD=N'ezTest', DEFAULT_DATABASE=ez_test, CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; ALTER SERVER ROLE [sysadmin] ADD MEMBER ez_test" | ||
- name: Install dependencies | ||
run: composer update | ||
- name: Test with phpunit | ||
run: vendor\bin\phpunit --coverage-clover=coverage.xml | ||
- name: Submit code coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage.xml # optional |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.