Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Apr 5, 2024
1 parent 8722a37 commit ff9b0fe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
POSTGRES_PASSWORD: postgres

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Service
if: matrix.db-type == 'mysql'
Expand All @@ -46,7 +46,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down Expand Up @@ -81,21 +81,21 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, pdo_pgsql
extensions: mbstring, intl, pdo_mysql
coverage: none

- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -104,8 +104,13 @@ jobs:
- name: Prepare config
run: cp config/app_local.ci.php config/app_local.php

- name: Setup Service
run: |
sudo service mysql start
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;'
- name: Prepare DB
run: export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'
run: export DB_URL='mysql://root:root@127.0.0.1/cakephp'

- name: Composer install
run: composer install --no-progress --prefer-dist --optimize-autoloader
Expand Down
29 changes: 15 additions & 14 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Cake\Core\Configure;
use Cake\Datasource\ConnectionManager;
use Cake\Log\Log;
use Cake\Routing\Route\DashedRoute;
use Cake\Routing\Router;
Expand Down Expand Up @@ -43,26 +44,26 @@

require ROOT . '/vendor/dereuromark/cakephp-tools/config/bootstrap.php';



// Ensure default test connection is defined
if (getenv('DB_URL') === 'sqlite:///:memory:') {
putenv('DB_URL=');
putenv('DB_CLASS=' . 'Cake\Database\Driver\Sqlite');
putenv('DB_DATABASE=' . TMP . 'debug_kit.sqlite');
}

/*
ConnectionManager::drop('test');
ConnectionManager::setConfig('test', [
'className' => 'Cake\Database\Connection',
'driver' => getenv('DB_CLASS') ?: 'Cake\Database\Driver\Sqlite',
'database' => getenv('DB_DATABASE') ?: TMP . 'debug_kit.sqlite',
'url' => getenv('DB_URL') ?: null,
'timezone' => 'UTC',
'encoding' => 'utf8',
'quoteIdentifiers' => true,
'cacheMetadata' => true,
]);
*/
ConnectionManager::drop('test');
ConnectionManager::setConfig('test', [
'className' => 'Cake\Database\Connection',
'driver' => getenv('DB_CLASS') ?: 'Cake\Database\Driver\Sqlite',
'database' => getenv('DB_DATABASE') ?: TMP . 'debug_kit.sqlite',
'url' => getenv('DB_URL') ?: null,
'timezone' => 'UTC',
'encoding' => 'utf8',
'quoteIdentifiers' => true,
'cacheMetadata' => true,
]);
}

Configure::write('Error.ignoredDeprecationPaths', [
'vendor/*',
Expand Down

0 comments on commit ff9b0fe

Please sign in to comment.