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
107 changes: 103 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,67 @@ on:
pull_request:
branches: [main, master]

# Superseded PR runs are cancelled. Push runs (main/master) get their own group (run_id), so a main run is never
# cancelled, not even while pending: tag_when_green.sh needs a completed run on every release commit.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
# Light mode (docs/GITHUB_CI.md#light-mode-for-deps-and-docs-only-prs): one representative cell plus the cheap
# gates. The org (or repo) Actions variable NOWO_CI_PR_MODE picks the PR mode: light = every PR light; full = every
# PR full; auto / unset = light only when the PR touches nothing but composer.json / composer.lock (root or demo),
# docs/**, *.md, .github/ISSUE_TEMPLATE/**, specs/** or .cursor/**. push, tags, workflow_dispatch and schedule are
# always full. Fail-closed: any error, unknown value or empty output means full (jobs reduce only on 'light').
changes:
name: Change scope (light or full)
runs-on: ubuntu-latest
outputs:
mode: ${{ steps.classify.outputs.mode }}
steps:
- name: Checkout code (PR merge commit and its base parent)
if: github.event_name == 'pull_request'
uses: actions/checkout@v7
with:
fetch-depth: 2

- name: Classify the change
id: classify
env:
EVENT: ${{ github.event_name }}
SWITCH: ${{ vars.NOWO_CI_PR_MODE }}
LIGHT: '^((demo/([^/]+/)?)?composer\.(json|lock)|docs/.*|specs/.*|\.cursor/.*|\.github/ISSUE_TEMPLATE/.*|.*\.md)$'
run: |
mode=full; paths=""
if [ "$EVENT" != pull_request ]; then
reason="event '$EVENT' always runs full"
else
case "$SWITCH" in
light) mode=light; reason="NOWO_CI_PR_MODE=light: every PR is light" ;;
full) reason="NOWO_CI_PR_MODE=full: every PR is full" ;;
''|auto)
if files=$(git diff --name-only --no-renames HEAD^1 HEAD); then
mode=light; reason="NOWO_CI_PR_MODE=${SWITCH:-unset} (auto): only deps/docs paths changed"
while IFS= read -r f; do
[ -n "$f" ] || continue
if ! printf '%s\n' "$f" | grep -Eq "$LIGHT"; then mode=full; paths="$paths $f"; fi
done <<< "$files"
[ "$mode" = light ] || reason="NOWO_CI_PR_MODE=${SWITCH:-unset} (auto): non deps/docs paths changed:$paths"
else
reason="NOWO_CI_PR_MODE=${SWITCH:-unset} (auto): git diff failed, fail-closed"
fi ;;
*) reason="NOWO_CI_PR_MODE='$SWITCH' is not light/auto/full, fail-closed" ;;
esac
fi
echo "mode=$mode ($reason)"
echo "mode=$mode" >> "$GITHUB_OUTPUT"
{
echo "### CI mode: \`$mode\`"
echo ""
echo "$reason"
if [ "$EVENT" = pull_request ] && [ -n "${files:-}" ]; then echo ""; echo "Changed paths:"; echo '```'; echo "$files" | head -200; echo '```'; fi
} >> "$GITHUB_STEP_SUMMARY"

git-hygiene:
name: Git history (no Cursor co-author)
runs-on: ubuntu-latest
Expand All @@ -24,6 +84,9 @@ jobs:
test:
name: PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: changes
# Never skip this job: a skipped matrix job reports its un-expanded name and the required contexts never appear.
if: ${{ !cancelled() }}

strategy:
fail-fast: false
Expand All @@ -39,11 +102,19 @@ jobs:
- php: '8.3'
symfony: '8.1'

env:
HEAVY: ${{ needs.changes.outputs.mode != 'light' || (matrix.php == '8.5' && matrix.symfony == '8.1') }}
steps:
- name: Light mode (deps/docs-only PR) - covered by PHP 8.5 - Symfony 8.1
if: env.HEAVY != 'true'
run: echo "Light mode, this cell has nothing to do."

- name: Checkout code
if: env.HEAVY == 'true'
uses: actions/checkout@v7

- name: Setup PHP
if: env.HEAVY == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Expand All @@ -52,13 +123,16 @@ jobs:
tools: composer:v2

- name: Validate composer.json
if: env.HEAVY == 'true'
run: composer validate --strict

- name: Get Composer cache directory
if: env.HEAVY == 'true'
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
if: env.HEAVY == 'true'
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
Expand All @@ -68,9 +142,11 @@ jobs:
${{ runner.os }}-php-${{ matrix.php }}-composer-

- name: Override Composer platform PHP (composer.json pins the minimum PHP for the lock)
if: env.HEAVY == 'true'
run: composer config platform.php "${{ matrix.php }}.99"

- name: Install dependencies with Symfony ${{ matrix.symfony }}
if: env.HEAVY == 'true'
run: |
echo "📦 Installing dependencies for Symfony ${{ matrix.symfony }}..."
# doctrine/doctrine-bundle ^3.0 requires PHP ^8.4; use ^2.10 on PHP 8.2/8.3.
Expand All @@ -92,10 +168,12 @@ jobs:
composer require symfony/yaml:^${{ matrix.symfony }} --dev --no-interaction --no-update
composer update --with-all-dependencies --no-interaction --prefer-dist --no-progress
- name: Composer audit (Critical/High)
if: env.HEAVY == 'true'
run: composer audit --locked


- name: Run tests
if: env.HEAVY == 'true'
run: |
echo "🧪 Running tests on PHP ${{ matrix.php }} with Symfony ${{ matrix.symfony }}..."
composer test
Expand All @@ -106,7 +184,7 @@ jobs:
echo "✅ All tests passed successfully"

- name: Validate coverage (PHP 8.2 with Symfony 7.4 only)
if: matrix.php == '8.2' && matrix.symfony == '7.4'
if: env.HEAVY == 'true' && (matrix.php == '8.2' && matrix.symfony == '7.4')
run: |
echo "📊 Generating coverage report..."
composer test-coverage
Expand Down Expand Up @@ -246,6 +324,9 @@ jobs:
real-databases:
name: Inbound capture in an open transaction and GDPR ports on PostgreSQL and MySQL
runs-on: ubuntu-latest
# Light mode: skipped (a skipped non-matrix job reports its own name with success for branch protection).
needs: changes
if: ${{ !cancelled() && needs.changes.outputs.mode != 'light' }}
services:
postgres:
image: postgres:17-alpine
Expand Down Expand Up @@ -327,26 +408,29 @@ jobs:
database:
name: Real databases (MySQL 8.4, MariaDB 11.4, PostgreSQL 16) - DBAL ${{ matrix.dbal }}
runs-on: ubuntu-latest
needs: changes
# Never skip this job: a skipped matrix job reports its un-expanded name and the required contexts never appear.
if: ${{ !cancelled() }}

services:
mysql:
image: mysql:8.4
image: ${{ needs.changes.outputs.mode != 'light' && 'mysql:8.4' || '' }}
env:
MYSQL_ROOT_PASSWORD: ci-placeholder
MYSQL_DATABASE: http_log
ports: ['3306:3306']
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -pci-placeholder" --health-interval 5s --health-timeout 5s --health-retries 30
mariadb:
image: mariadb:11.4
image: ${{ needs.changes.outputs.mode != 'light' && 'mariadb:11.4' || '' }}
env:
MARIADB_ROOT_PASSWORD: ci-placeholder
MARIADB_DATABASE: http_log
ports: ['3307:3306']
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized" --health-interval 5s --health-timeout 5s --health-retries 30
postgres:
image: postgres:16-alpine
image: ${{ needs.changes.outputs.mode != 'light' && 'postgres:16-alpine' || '' }}
env:
POSTGRES_PASSWORD: ci-placeholder
POSTGRES_DB: http_log
Expand All @@ -359,11 +443,19 @@ jobs:
matrix:
dbal: ['3', '4']

env:
HEAVY: ${{ needs.changes.outputs.mode != 'light' }}
steps:
- name: Light mode (deps/docs-only PR) - no database run
if: env.HEAVY != 'true'
run: echo "Light mode, this cell has nothing to do."

- name: Checkout code
if: env.HEAVY == 'true'
uses: actions/checkout@v7

- name: Setup PHP
if: env.HEAVY == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
Expand All @@ -372,13 +464,15 @@ jobs:
tools: composer:v2

- name: Install dependencies (DBAL ${{ matrix.dbal }})
if: env.HEAVY == 'true'
run: |
composer config platform.php 8.4.1
composer require doctrine/dbal:^${{ matrix.dbal }} --no-interaction --no-update
composer update --with-all-dependencies --prefer-dist --no-progress --no-interaction
composer show doctrine/dbal

- name: Concurrency tests on MySQL 8.4, MariaDB 11.4 and PostgreSQL 16 (REQ-RUNTIME-003)
if: env.HEAVY == 'true'
timeout-minutes: 10
env:
HTTPLOG_TEST_MYSQL_URL: mysql://root:ci-placeholder@127.0.0.1:3306/http_log?serverVersion=8.4.0&charset=utf8mb4
Expand All @@ -391,6 +485,7 @@ jobs:
# Audit VB-5: only the skips by design may happen (the opt-in performance test, and the PostgreSQL id conversion
# test of the other DBAL major); check-skips.py fails on any other skipped test.
- name: Integration suite on MySQL 8.4 and PostgreSQL 16 (DBAL ${{ matrix.dbal }})
if: env.HEAVY == 'true'
timeout-minutes: 15
env:
HTTPLOG_TEST_MYSQL_URL: mysql://root:ci-placeholder@127.0.0.1:3306/http_log?serverVersion=8.4.0&charset=utf8mb4
Expand All @@ -402,6 +497,7 @@ jobs:
"${{ matrix.dbal == '3' && 'RollupSchemaTest::theMoveToDbal4KeepsTheIdsAndLeavesNoSchemaDiff=1' || 'RollupSchemaTest::theDbal3IdentityConversionLeavesNoSchemaDiff=1' }}"

- name: Integration suite on MariaDB 11.4 and PostgreSQL 16 (DBAL ${{ matrix.dbal }})
if: env.HEAVY == 'true'
timeout-minutes: 15
env:
HTTPLOG_TEST_MYSQL_URL: mysql://root:ci-placeholder@127.0.0.1:3307/http_log?serverVersion=11.4.0-MariaDB&charset=utf8mb4
Expand Down Expand Up @@ -453,6 +549,9 @@ jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
# Light mode: skipped (a skipped non-matrix job reports its own name with success for branch protection).
needs: changes
if: ${{ !cancelled() && needs.changes.outputs.mode != 'light' }}

steps:
- name: Checkout code
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
semantic-pr:
name: Validate semantic PR title
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"doctrine/orm": "^3.7",
"nowo-tech/form-kit-bundle": "^2.10",
"nowo-tech/transaction-contract": "^1.0",
"nowo-tech/transaction-doctrine": "^1.6",
"nowo-tech/transaction-doctrine": "^1.8.1",
"nowo-tech/ui-kit-bundle": "^2.2",
"psr/clock": "^1.0",
"psr/event-dispatcher": "^1.0",
Expand Down
29 changes: 17 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading