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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.github/ export-ignore
.gitignore export-ignore
.phpactor.json export-ignore
.roave-backward-compatibility-check.xml export-ignore
CHANGELOG.md export-ignore
docs/ export-ignore
phpstan-baseline.neon export-ignore
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/backward-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Backward compatibility

on:
pull_request:
push:
tags:
- 'v*'

permissions:
contents: read

jobs:
roave-bc-check:
name: Roave BC check
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Pick the versions to compare
id: refs
run: |
mapfile -t tags < <(git tag --list --sort=-v:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' || true)
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
to="${GITHUB_REF_NAME}"
from=""
seen=0
for t in "${tags[@]}"; do
if [ "$seen" = 1 ]; then from="$t"; break; fi
if [ "$t" = "$to" ]; then seen=1; fi
done
if [ -n "$from" ] && [ "${from%%.*}" != "${to%%.*}" ]; then
echo "::notice::${to} is a new major version after ${from}, skipping the check."
from=""
fi
else
to="HEAD"
from="${tags[0]:-}"
fi
if [ -z "$from" ]; then
echo "No earlier release tag to compare against, skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Comparing ${from} to ${to}"
{
echo "skip=false"
echo "from=${from}"
echo "to=${to}"
} >> "$GITHUB_OUTPUT"

- uses: shivammathur/setup-php@v2
if: steps.refs.outputs.skip != 'true'
with:
php-version: '8.4'
extensions: dom, curl, libxml, mbstring, zip, intl
coverage: none
tools: composer:v2

- name: Install roave/backward-compatibility-check (CI only, not added to composer.json)
if: steps.refs.outputs.skip != 'true'
run: |
export COMPOSER_HOME="$RUNNER_TEMP/bc-composer"
echo "COMPOSER_HOME=$COMPOSER_HOME" >> "$GITHUB_ENV"
# Let older tagged releases install their pinned dependencies for the comparison.
composer config --global audit.block-insecure false
composer global require --no-interaction --no-progress roave/backward-compatibility-check:^8.27

- name: Check for BC breaks
if: steps.refs.outputs.skip != 'true'
env:
FROM_REF: ${{ steps.refs.outputs.from }}
TO_REF: ${{ steps.refs.outputs.to }}
run: |
php -d memory_limit=-1 "$COMPOSER_HOME/vendor/bin/roave-backward-compatibility-check" \
--from="$FROM_REF" --to="$TO_REF" --format=console --format=github-actions
14 changes: 14 additions & 0 deletions .roave-backward-compatibility-check.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Baseline for roave/backward-compatibility-check.
Only ignores changes that come from the Symfony and Laravel console base classes
that the package commands extend, not changes to this package's own API.
-->
<roave-bc-check
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/Roave/BackwardCompatibilityCheck/8.27.x/Resources/schema.xsd">
<baseline>
<ignored-regex>#\[BC\] REMOVED: Method [^ ]+ \(inherited from (Symfony\\Component\\Console|Illuminate\\Console)\\[^)]+\) was removed#</ignored-regex>
<ignored-regex>#\[BC\] CHANGED: The return type of (Symfony\\Component\\Console|Illuminate\\Console)\\[^ ]+\#[A-Za-z_]+\(\) changed from no type to void#</ignored-regex>
</baseline>
</roave-bc-check>
Loading