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
81 changes: 6 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,19 @@ jobs:
echo "::notice::CI checks will execute - the actor is not the release-please bot"
fi

tests:
code-quality:
needs: should-run
if: needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
name: "PHP ${{ matrix.php }} + Doctrine ORM ${{ matrix.doctrine-orm }} + Doctrine Lexer ${{ matrix.doctrine-lexer }}"
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
doctrine-lexer: ['2.1', '3.0', 'latest']
doctrine-orm: ['2.14', '2.18', '3.0', 'latest']
include:
- php: '8.1'
doctrine-orm: '2.14'
doctrine-lexer: '1.2'
- php: '8.4' # Run coverage report only based on the latest dependencies
doctrine-lexer: 'latest'
doctrine-orm: 'latest'
calculate-code-coverage: true
exclude:
- doctrine-orm: '2.14'
doctrine-lexer: '3.0'
- doctrine-orm: '3.0'
doctrine-lexer: '2.1'
name: "Code Quality"

steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4

- name: Set up PHP with PECL extension
- name: Set up PHP
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
php-version: '8.4'
extensions: ctype, json, mbstring
tools: composer

Expand All @@ -78,60 +58,11 @@ jobs:
restore-keys: |
${{ runner.os }}-php-

- name: Install Doctrine Lexer dependency
run: |
if [ "${{ matrix.doctrine-lexer }}" = "1.2" ]; then
composer require doctrine/lexer "~1.2" --dev --prefer-dist --no-interaction --no-progress
elif [ "${{ matrix.doctrine-lexer }}" = "2.1" ]; then
composer require doctrine/lexer "~2.1" --dev --prefer-dist --no-interaction --no-progress
elif [ "${{ matrix.doctrine-lexer }}" = "3.0" ]; then
composer require doctrine/lexer "~3.0" --dev --prefer-dist --no-interaction --no-progress
else
composer update --prefer-dist --no-interaction --no-progress
fi

- name: Install Doctrine ORM dependency
run: |
if [ "${{ matrix.doctrine-orm }}" = "2.14" ]; then
composer require doctrine/orm "~2.14" --prefer-dist --no-interaction --no-progress --with-all-dependencies
elif [ "${{ matrix.doctrine-orm }}" = "2.18" ]; then
composer require doctrine/orm "~2.18" --prefer-dist --no-interaction --no-progress --with-all-dependencies
elif [ "${{ matrix.doctrine-orm }}" = "3.0" ]; then
composer require doctrine/orm "~3.0" --prefer-dist --no-interaction --no-progress --with-all-dependencies
else
composer update --prefer-dist --no-interaction --no-progress
fi

- name: Run static analysis
run: composer run-static-analysis
continue-on-error: ${{ matrix.continue-on-error || false }}
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Check code style
run: composer check-code-style

- name: Check for security vulnerabilities in 3rd party dependencies
run: composer audit

- name: Run unit test suite
run: composer run-unit-tests

- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == true
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./var/logs/test-coverage/unit/clover.xml
parallel: true
flag-name: "Unit"
fail-on-error: false

coveralls-finish:
needs: tests
if: always()
runs-on: ubuntu-latest
steps:
- name: Finalize Coveralls parallel run
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
47 changes: 47 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Coverage

on:
workflow_run:
workflows: ["Integration Tests", "Unit Tests"]
types: [completed]

jobs:
finalize:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_sha == github.sha }}
# Needed for listWorkflowRunsForRepo and safe defaults for token scope
permissions:
actions: read
contents: read
statuses: write
# Prevent multiple concurrent finalizers for the same commit
concurrency:
group: coverage-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: true
steps:
- id: check
uses: actions/github-script@v7
with:
script: |
const workflows = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
status: 'completed',
per_page: 100
});

const bothComplete = ['Integration Tests', 'Unit Tests'].every(name =>
workflows.data.workflow_runs.some(
run => run.name === name && run.conclusion === 'success'
)
);

core.info(bothComplete ? 'Both workflows completed successfully.' : 'Waiting for other workflow to complete.');
core.setOutput('ready', String(bothComplete));

- if: ${{ steps.check.outputs.ready == 'true' }}
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
16 changes: 15 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integrations
name: Integration Tests

on:
push:
Expand Down Expand Up @@ -41,6 +41,10 @@ jobs:
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
postgres: ['16', '17']
include:
- php: '8.4'
postgres: '17'
calculate-code-coverage: true

services:
postgres:
Expand Down Expand Up @@ -114,3 +118,13 @@ jobs:
POSTGRES_DB: postgres_doctrine_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == true
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./var/logs/test-coverage/integration/clover.xml
parallel: true
flag-name: "Integration"
fail-on-error: false
118 changes: 118 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Unit Tests

on:
push:
branches:
- main
paths-ignore:
- '.github/actions/release-please/**'
pull_request:
branches:
- main

permissions:
contents: read

jobs:
should-run:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.check.outputs.run }}
steps:
- name: Skip for release-please
id: check
run: |
if [ "${{ github.event.pull_request.user.id }}" = "41898282" ]; then
echo "run=false" >> $GITHUB_OUTPUT
echo "::notice::Skipping unit tests - this a release-please bot's interaction"
else
echo "run=true" >> $GITHUB_OUTPUT
echo "::notice::Unit tests will execute - the actor is not the release-please bot"
fi

unit-tests:
needs: should-run
if: needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
name: "PHP ${{ matrix.php }} + Doctrine ORM ${{ matrix.doctrine-orm }} + Doctrine Lexer ${{ matrix.doctrine-lexer }}"

strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
doctrine-lexer: ['2.1', '3.0', 'latest']
doctrine-orm: ['2.14', '2.18', '3.0', 'latest']
include:
- php: '8.1'
doctrine-orm: '2.14'
doctrine-lexer: '1.2'
- php: '8.4' # Run coverage report only based on the latest dependencies
doctrine-lexer: 'latest'
doctrine-orm: 'latest'
calculate-code-coverage: true
exclude:
- doctrine-orm: '2.14'
doctrine-lexer: '3.0'
- doctrine-orm: '3.0'
doctrine-lexer: '2.1'

steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4

- name: Set up PHP with PECL extension
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: ctype, json, mbstring
tools: composer

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install Doctrine Lexer dependency
run: |
if [ "${{ matrix.doctrine-lexer }}" = "1.2" ]; then
composer require doctrine/lexer "~1.2" --dev --prefer-dist --no-interaction --no-progress
elif [ "${{ matrix.doctrine-lexer }}" = "2.1" ]; then
composer require doctrine/lexer "~2.1" --dev --prefer-dist --no-interaction --no-progress
elif [ "${{ matrix.doctrine-lexer }}" = "3.0" ]; then
composer require doctrine/lexer "~3.0" --dev --prefer-dist --no-interaction --no-progress
else
composer update --prefer-dist --no-interaction --no-progress
fi

- name: Install Doctrine ORM dependency
run: |
if [ "${{ matrix.doctrine-orm }}" = "2.14" ]; then
composer require doctrine/orm "~2.14" --prefer-dist --no-interaction --no-progress --with-all-dependencies
elif [ "${{ matrix.doctrine-orm }}" = "2.18" ]; then
composer require doctrine/orm "~2.18" --prefer-dist --no-interaction --no-progress --with-all-dependencies
elif [ "${{ matrix.doctrine-orm }}" = "3.0" ]; then
composer require doctrine/orm "~3.0" --prefer-dist --no-interaction --no-progress --with-all-dependencies
else
composer update --prefer-dist --no-interaction --no-progress
fi

- name: Run static analysis
run: composer run-static-analysis
continue-on-error: ${{ matrix.continue-on-error || false }}

- name: Run unit test suite
run: composer run-unit-tests

- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == true
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./var/logs/test-coverage/unit/clover.xml
parallel: true
flag-name: "Unit"
fail-on-error: false
Loading