Skip to content

Commit

Permalink
[11.x] Add MSSQL 2017 and PGSQL 10 builds (#52631)
Browse files Browse the repository at this point in the history
* Add MSSQL 2017 and PGSQL 10 builds

* Update databases.yml

* Skip Tests (#52632)

* [DB-Test] Assert different number of types in pgsql 10 (#52638)

* Find out which types are not counted

* dump types

* Bypass count check for pgsql 10

---------

Co-authored-by: Julius Kiekbusch <contact@julius-kiekbusch.de>
  • Loading branch information
driesvints and Jubeki authored Sep 5, 2024
1 parent 769f00b commit 4579141
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 3 deletions.
99 changes: 97 additions & 2 deletions .github/workflows/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
env:
DB_CONNECTION: mariadb

pgsql:
pgsql_14:
runs-on: ubuntu-24.04

services:
Expand Down Expand Up @@ -192,7 +192,55 @@ jobs:
DB_USERNAME: forge
DB_PASSWORD: password

mssql:
pgsql_10:
runs-on: ubuntu-24.04

services:
postgresql:
image: postgres:10
env:
POSTGRES_DB: laravel
POSTGRES_USER: forge
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: true

name: PostgreSQL 10

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, :php-psr
tools: composer:v2
coverage: none

- name: Set Framework version
run: composer config version "11.x-dev"

- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit tests/Integration/Database
env:
DB_CONNECTION: pgsql
DB_USERNAME: forge
DB_PASSWORD: password

mssql_2019:
runs-on: ubuntu-22.04

services:
Expand Down Expand Up @@ -239,6 +287,53 @@ jobs:
DB_USERNAME: SA
DB_PASSWORD: Forge123

mssql_2017:
runs-on: ubuntu-22.04

services:
sqlsrv:
image: mcr.microsoft.com/mssql/server:2017-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: Forge123
ports:
- 1433:1433

strategy:
fail-fast: true

name: SQL Server 2017

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, :php-psr
tools: composer:v2
coverage: none

- name: Set Framework version
run: composer config version "11.x-dev"

- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit tests/Integration/Database
env:
DB_CONNECTION: sqlsrv
DB_DATABASE: master
DB_USERNAME: SA
DB_PASSWORD: Forge123

sqlite:
runs-on: ubuntu-24.04

Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/Database/Postgres/FulltextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function testWhereFulltext()

public function testWhereFulltextWithWebsearch()
{
if (version_compare($this->getConnection()->getServerVersion(), '11.0', '<')) {
$this->markTestSkipped('Test requires a PostgreSQL connection >= 11.0');
}

$articles = DB::table('articles')->whereFulltext(['title', 'body'], '+PostgreSQL -YourSQL', ['mode' => 'websearch'])->get();

$this->assertCount(5, $articles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public function testGetViews()

public function testDropPartitionedTables()
{
if (version_compare($this->getConnection()->getServerVersion(), '11.0', '<')) {
$this->markTestSkipped('Test requires a PostgreSQL connection >= 11.0');
}

DB::statement('create table groups (id bigserial, tenant_id bigint, name varchar, primary key (id, tenant_id)) partition by hash (tenant_id)');
DB::statement('create table groups_1 partition of groups for values with (modulus 2, remainder 0)');
DB::statement('create table groups_2 partition of groups for values with (modulus 2, remainder 1)');
Expand Down
11 changes: 10 additions & 1 deletion tests/Integration/Database/SchemaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,12 @@ public function testGetAndDropTypes()

$types = Schema::getTypes();

$this->assertCount(13, $types);
if (version_compare($this->getConnection()->getServerVersion(), '14.0', '<')) {
$this->assertCount(10, $types);
} else {
$this->assertCount(13, $types);
}

$this->assertTrue(collect($types)->contains(fn ($type) => $type['name'] === 'pseudo_foo' && $type['type'] === 'pseudo' && ! $type['implicit']));
$this->assertTrue(collect($types)->contains(fn ($type) => $type['name'] === 'comp_foo' && $type['type'] === 'composite' && ! $type['implicit']));
$this->assertTrue(collect($types)->contains(fn ($type) => $type['name'] === 'enum_foo' && $type['type'] === 'enum' && ! $type['implicit']));
Expand Down Expand Up @@ -669,6 +674,10 @@ public function testModifyingStoredColumnOnSqlite()

public function testGettingGeneratedColumns()
{
if ($this->driver === 'pgsql' && version_compare($this->getConnection()->getServerVersion(), '12.0', '<')) {
$this->markTestSkipped('Test requires a PostgreSQL connection >= 12.0');
}

Schema::create('test', function (Blueprint $table) {
$table->integer('price');

Expand Down

0 comments on commit 4579141

Please sign in to comment.