Skip to content

Commit

Permalink
Fixed build testing [SLE-197]
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgfeller committed Apr 1, 2024
1 parent e57fcdb commit f80fe90
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, pdo, pdo_mysql, intl, zip
coverage: xdebug
coverage: none

- name: Check PHP version
run: php -v
Expand Down Expand Up @@ -69,6 +69,8 @@ jobs:

- name: Execute database migrations
run: composer migrate-prod
env:
APP_ENV: github

- name: Show test db tables
run: mysql -uroot -proot -D ${{ matrix.test-database }} -e "SHOW TABLES;"
Expand Down
78 changes: 39 additions & 39 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
filter:
paths: [ "src/*" ]
excluded_paths: [ "vendor/*", "tests/*", "resources/", "public/" ]
paths: [ "src/*" ]
excluded_paths: [ "vendor/*", "tests/*", "resources/", "public/" ]

checks:
php:
code_rating: true
duplication: true
php:
code_rating: true
duplication: true

tools:
external_code_coverage: false
external_code_coverage: false

build:
services:
mysql: 8.0.29
environment:
php:
version: 8.2
ini:
xdebug.mode: coverage
mysql: 5.7
node: false
postgresql: false
mongodb: false
elasticsearch: false
redis: false
memcached: false
neo4j: false
rabbitmq: false
variables:
APP_ENV: 'github'
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
dependencies:
before:
- composer self-update
- mysql -u root -e "CREATE DATABASE IF NOT EXISTS slim_api_example_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
tests:
before:
- command: composer test:coverage
coverage:
file: 'build/logs/clover.xml'
format: 'clover'
services:
mysql: 8.0.29
environment:
php:
version: 8.2
ini:
xdebug.mode: coverage
mysql: 5.7
node: false
postgresql: false
mongodb: false
elasticsearch: false
redis: false
memcached: false
neo4j: false
rabbitmq: false
variables:
APP_ENV: 'scrutinizer'
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
dependencies:
before:
- composer self-update
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS slim_api_example_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
tests:
before:
- command: composer test:coverage
coverage:
file: 'build/logs/clover.xml'
format: 'clover'
2 changes: 1 addition & 1 deletion config/env/env.github.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Add all test settings

// MUST NOT be require_once as otherwise test settings such as mailer transport type is
// MUST be "require" and NOT require_once as otherwise test settings such as mailer transport type are
// only included once and not again for the next tests
// (tested by echoing $settings['smtp']['type'] after settings arr is built in settings.php)
require __DIR__ . '/env.test.php';
Expand Down
10 changes: 10 additions & 0 deletions config/env/env.scrutinizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

// Must be "require" and not require_once
require __DIR__ . '/env.test.php';

// Database
$settings['db']['host'] = '127.0.0.1';
$settings['db']['database'] = 'slim_api_starter_test';
$settings['db']['username'] = 'root';
$settings['db']['password'] = '';

0 comments on commit f80fe90

Please sign in to comment.