Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Tests

# Unit + integration test suites (see tests/COVERAGE-PLAN.md). Complements the existing gates:
# version-check (tag == VERSION), smoke (boots/migrates/serves), release-zip (vendored ZIP).
# This one runs the actual PHPUnit suites on every push to main and every PR.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
# Fast, no services — the bulk of coverage. Full PHP matrix (mirrors smoke.yml).
unit:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, curl, zip, gd, sodium, apcu
ini-values: apc.enable_cli=1, memory_limit=512M
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Unit suite
run: composer test:unit

# Needs a database — one PHP version is enough; the schema, not the interpreter, is under test.
integration:
runs-on: ubuntu-latest
timeout-minutes: 15
services:
mariadb:
image: mariadb:10.11
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: tiger_test
ports: ['3306:3306']
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=15
env:
TIGER_TEST_DB_HOST: 127.0.0.1
TIGER_TEST_DB_PORT: 3306
TIGER_TEST_DB_NAME: tiger_test
TIGER_TEST_DB_USER: root
TIGER_TEST_DB_PASS: root
steps:
- uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl, pdo_mysql, curl, zip, gd, sodium, apcu
ini-values: apc.enable_cli=1, memory_limit=512M
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Integration suite (real MariaDB schema)
run: composer test:integration
25 changes: 22 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"name": "webtigers/tiger-core",
"description": "Tiger platform Core kernel + multi-tenant substrate (org/user/org_user/ACL) on TigerZF",
"description": "Tiger platform Core \u2014 kernel + multi-tenant substrate (org/user/org_user/ACL) on TigerZF",
"type": "library",
"keywords": ["tiger", "saas", "multi-tenant", "zf1", "tigerzf"],
"keywords": [
"tiger",
"saas",
"multi-tenant",
"zf1",
"tigerzf"
],
"homepage": "https://github.com/WebTigers/tiger-core/",
"license": "BSD-3-Clause",
"require": {
Expand Down Expand Up @@ -31,5 +37,18 @@
],
"config": {
"sort-packages": true
},
"require-dev": {
"phpunit/phpunit": "^10.5 || ^11.5 || ^12.0"
},
"scripts": {
"test": "phpunit",
"test:unit": "phpunit --testsuite unit",
"test:integration": "phpunit --testsuite integration"
},
"autoload-dev": {
"psr-4": {
"Tiger\\Tests\\": "tests/"
}
}
}
}
49 changes: 49 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
tiger-core PHPUnit config. Two suites:
unit — no external services; runs anywhere (the bulk of fast coverage).
integration — needs a MySQL/MariaDB fixture DB (see tests/Support/IntegrationTestCase.php);
CI provides one, and it's skipped locally when TIGER_TEST_DB is unset.
Schema is compatible with PHPUnit 10/11/12 (composer resolves the major per PHP version).
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
colors="true"
failOnRisky="true"
failOnWarning="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerErrors="true">

<testsuites>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory suffix=".php">library/Tiger</directory>
<directory suffix=".php">modules</directory>
<directory suffix=".php">core/controllers</directory>
</include>
<exclude>
<!-- vendored third-party (see COVERAGE-PLAN §6.2): not our coverage to chase -->
<directory>library/Tiger/Cms/vendor</directory>
<!-- data-not-code: migrations + i18n arrays are covered by integration/smoke, not units -->
<directory>migrations</directory>
<directory suffix=".php">modules/*/languages</directory>
<directory suffix=".php">core/languages</directory>
</exclude>
</source>

<php>
<env name="APPLICATION_ENV" value="testing"/>
</php>
</phpunit>
Loading
Loading