From ef191d65c6e217477fd33b0e233feb47da265a6c Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Wed, 13 Mar 2024 11:43:56 +1000 Subject: [PATCH] Add mssql workflow job --- .github/workflows/tests.yml | 55 +++++++++++++++++++ .../2023_06_07_000001_create_pulse_tables.php | 3 + src/Support/PulseMigration.php | 3 +- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba6cf92f..60b26c1b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -182,6 +182,61 @@ jobs: DB_USERNAME: pulse DB_PASSWORD: password + mssql: + runs-on: ubuntu-22.04 + + services: + sqlsrv: + image: mcr.microsoft.com/mssql/server:2019-latest + env: + ACCEPT_EULA: Y + SA_PASSWORD: Password123 + ports: + - 1433:1433 + redis: + image: redis + ports: + - 6379:6379 + options: --entrypoint redis-server + + strategy: + fail-fast: true + matrix: + php: [8.3] + laravel: [11] + stability: [prefer-stable] + + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - Stability ${{ matrix.stability }} - SQL Server 2019 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, redis, pcntl, zip + ini-values: error_reporting=E_ALL + tools: composer:v2 + coverage: none + + - name: Install redis-cli + run: sudo apt-get install -qq redis-tools + + - name: Install dependencies + run: | + composer require "illuminate/contracts=^${{ matrix.laravel }}" --dev --no-update + composer update --prefer-dist --no-interaction --no-progress + + - name: Execute tests + run: vendor/bin/pest + env: + DB_CONNECTION: sqlsrv + DB_DATABASE: master + DB_USERNAME: SA + DB_PASSWORD: Password123 + sqlite: runs-on: ubuntu-22.04 diff --git a/database/migrations/2023_06_07_000001_create_pulse_tables.php b/database/migrations/2023_06_07_000001_create_pulse_tables.php index 5d194e2c..47d48f0a 100644 --- a/database/migrations/2023_06_07_000001_create_pulse_tables.php +++ b/database/migrations/2023_06_07_000001_create_pulse_tables.php @@ -24,6 +24,7 @@ public function up(): void 'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'), 'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'), 'sqlite' => $table->string('key_hash'), + 'sqlsrv' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'), }; $table->mediumText('value'); @@ -41,6 +42,7 @@ public function up(): void 'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'), 'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'), 'sqlite' => $table->string('key_hash'), + 'sqlsrv' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'), }; $table->bigInteger('value')->nullable(); @@ -60,6 +62,7 @@ public function up(): void 'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'), 'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'), 'sqlite' => $table->string('key_hash'), + 'sqlsrv' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'), }; $table->string('aggregate'); $table->decimal('value', 20, 2); diff --git a/src/Support/PulseMigration.php b/src/Support/PulseMigration.php index c517088e..573ca7c2 100644 --- a/src/Support/PulseMigration.php +++ b/src/Support/PulseMigration.php @@ -2,7 +2,6 @@ namespace Laravel\Pulse\Support; -use Illuminate\Database\Connection; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Config; @@ -24,7 +23,7 @@ public function getConnection(): ?string */ protected function shouldRun(): bool { - if (in_array($this->driver(), ['mariadb', 'mysql', 'pgsql', 'sqlite'])) { + if (in_array($this->driver(), ['mariadb', 'mysql', 'pgsql', 'sqlite', 'sqlsrv'])) { return true; }