Skip to content

Commit e80f80c

Browse files
committed
[ci] Run required PR tests without path filters (#230)
1 parent ff479d3 commit e80f80c

3 files changed

Lines changed: 7 additions & 82 deletions

File tree

.github/workflows/tests.yml

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,9 @@ jobs:
4848
php-version: ${{ steps.resolve.outputs.php-version }}
4949
php-version-source: ${{ steps.resolve.outputs.php-version-source }}
5050
test-matrix: ${{ steps.resolve.outputs.test-matrix }}
51-
run-tests: ${{ steps.scope.outputs.run-tests }}
52-
test-scope-reason: ${{ steps.scope.outputs.reason }}
5351

5452
steps:
5553
- uses: actions/checkout@v6
56-
with:
57-
fetch-depth: 0
5854
- name: Checkout dev-tools workflow action source
5955
uses: actions/checkout@v6
6056
with:
@@ -68,47 +64,6 @@ jobs:
6864
id: resolve
6965
uses: ./.dev-tools-actions/.github/actions/php/resolve-version
7066

71-
- name: Resolve test workflow scope
72-
id: scope
73-
shell: bash
74-
env:
75-
BASE_SHA: ${{ github.event.pull_request.base.sha || '' }}
76-
run: |
77-
set -euo pipefail
78-
79-
if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
80-
{
81-
echo "run-tests=true"
82-
echo "reason=non-pull-request-event"
83-
} >> "$GITHUB_OUTPUT"
84-
85-
exit 0
86-
fi
87-
88-
git fetch --no-tags --depth=1 origin "${BASE_SHA}"
89-
git diff --name-only "${BASE_SHA}...HEAD" > changed-files.txt
90-
91-
run_tests=false
92-
while IFS= read -r changed_file; do
93-
case "${changed_file}" in
94-
src/*|tests/*|composer.json|composer.lock|.github/actions/*|.github/workflows/tests.yml|resources/github-actions/tests.yml)
95-
run_tests=true
96-
break
97-
;;
98-
esac
99-
done < changed-files.txt
100-
101-
if [ "${run_tests}" = "true" ]; then
102-
reason="test-sensitive-pr-diff"
103-
else
104-
reason="no-test-sensitive-pr-diff"
105-
fi
106-
107-
{
108-
echo "run-tests=${run_tests}"
109-
echo "reason=${reason}"
110-
} >> "$GITHUB_OUTPUT"
111-
11267
tests:
11368
needs: resolve_php
11469
name: Run Tests
@@ -119,9 +74,7 @@ jobs:
11974
TESTS_ROOT_VERSION: ${{ github.event_name == 'pull_request' && format('dev-{0}', github.event.pull_request.head.ref) || 'dev-main' }}
12075
steps:
12176
- uses: actions/checkout@v6
122-
if: needs.resolve_php.outputs.run-tests == 'true'
12377
- name: Checkout dev-tools workflow action source
124-
if: needs.resolve_php.outputs.run-tests == 'true'
12578
uses: actions/checkout@v6
12679
with:
12780
repository: php-fast-forward/dev-tools
@@ -131,7 +84,6 @@ jobs:
13184
.github/actions
13285
13386
- name: Setup PHP and install dependencies
134-
if: needs.resolve_php.outputs.run-tests == 'true'
13587
uses: ./.dev-tools-actions/.github/actions/php/setup-composer
13688
with:
13789
php-version: ${{ matrix.php-version }}
@@ -141,29 +93,21 @@ jobs:
14193
install-options: --prefer-dist --no-progress --no-interaction --no-plugins --no-scripts
14294

14395
- name: Composer Audit
144-
if: needs.resolve_php.outputs.run-tests == 'true'
14596
env:
14697
COMPOSER_ROOT_VERSION: ${{ env.TESTS_ROOT_VERSION }}
14798
run: composer audit
14899

149100
- name: Resolve minimum coverage
150-
if: needs.resolve_php.outputs.run-tests == 'true'
151101
id: minimum-coverage
152102
run: echo "value=${INPUT_MIN_COVERAGE:-80}" >> "$GITHUB_OUTPUT"
153103
env:
154104
INPUT_MIN_COVERAGE: ${{ inputs.min-coverage }}
155105

156106
- name: Run PHPUnit tests
157-
if: needs.resolve_php.outputs.run-tests == 'true'
158107
env:
159108
COMPOSER_ROOT_VERSION: ${{ env.TESTS_ROOT_VERSION }}
160109
run: composer dev-tools tests -- --coverage=.dev-tools/coverage --min-coverage=${{ steps.minimum-coverage.outputs.value }}
161110

162-
- name: Mark tests intentionally skipped
163-
if: needs.resolve_php.outputs.run-tests != 'true'
164-
run: |
165-
echo "No test-sensitive PR diff detected; required test context completed without running PHPUnit."
166-
167111
dependency-health:
168112
needs: resolve_php
169113
name: Dependency Health
@@ -172,9 +116,7 @@ jobs:
172116
TESTS_ROOT_VERSION: ${{ github.event_name == 'pull_request' && format('dev-{0}', github.event.pull_request.head.ref) || 'dev-main' }}
173117
steps:
174118
- uses: actions/checkout@v6
175-
if: needs.resolve_php.outputs.run-tests == 'true'
176119
- name: Checkout dev-tools workflow action source
177-
if: needs.resolve_php.outputs.run-tests == 'true'
178120
uses: actions/checkout@v6
179121
with:
180122
repository: php-fast-forward/dev-tools
@@ -184,24 +126,17 @@ jobs:
184126
.github/actions
185127
186128
- name: Setup PHP and install dependencies
187-
if: needs.resolve_php.outputs.run-tests == 'true'
188129
uses: ./.dev-tools-actions/.github/actions/php/setup-composer
189130
with:
190131
php-version: ${{ needs.resolve_php.outputs.php-version }}
191132
root-version: ${{ env.TESTS_ROOT_VERSION }}
192133
install-options: --prefer-dist --no-progress --no-interaction --no-plugins --no-scripts
193134

194135
- name: Run dependency health check
195-
if: needs.resolve_php.outputs.run-tests == 'true'
196136
env:
197137
COMPOSER_ROOT_VERSION: ${{ env.TESTS_ROOT_VERSION }}
198138
run: composer dev-tools dependencies -- --max-outdated=${{ inputs.max-outdated || -1 }}
199139

200-
- name: Mark dependency health intentionally skipped
201-
if: needs.resolve_php.outputs.run-tests != 'true'
202-
run: |
203-
echo "No test-sensitive PR diff detected; dependency health completed without running dependency analysis."
204-
205140
summarize:
206141
if: ${{ always() }}
207142
name: Summarize Test Workflow
@@ -229,8 +164,6 @@ jobs:
229164
- Workflow PHP version: `${{ needs.resolve_php.outputs.php-version }}`
230165
- PHP version source: `${{ needs.resolve_php.outputs.php-version-source }}`
231166
- Test matrix: `${{ needs.resolve_php.outputs.test-matrix }}`
232-
- Test-sensitive diff: `${{ needs.resolve_php.outputs.run-tests }}`
233-
- Test scope reason: `${{ needs.resolve_php.outputs.test-scope-reason }}`
234167
- Minimum coverage threshold: `${{ inputs.min-coverage || 80 }}`
235168
- Dependency health `max-outdated`: `${{ inputs.max-outdated || -1 }}`
236169
- Tests job result: `${{ needs.tests.result }}`

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12-
- Keep required PHPUnit matrix checks reporting after workflow-managed `.github/wiki` pointer commits by moving PR test-skip decisions inside the tests workflow and aligning the packaged consumer test wrapper (#230)
12+
- Keep required PHPUnit matrix checks reporting after workflow-managed `.github/wiki` pointer commits by running the pull-request test workflow without top-level path filters and aligning the packaged consumer test wrapper (#230)
1313

1414
## [1.21.0] - 2026-04-24
1515

docs/advanced/branch-protection-and-bot-commits.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,12 @@ to refresh generated pointers manually. The preferred path is to allow bot
9797
updates on PR branches while keeping ``main`` protected.
9898

9999
Required test checks must still report for workflow-managed pointer commits.
100-
The tests workflow therefore triggers on every pull request update and resolves
101-
whether the effective pull request diff contains test-sensitive files inside the
102-
workflow itself. If the latest commit only refreshes ``.github/wiki`` and the
103-
pull request has no source, test, Composer, test-workflow, packaged test-wrapper,
104-
or local-action changes, the required ``Run Tests`` matrix jobs complete with an
105-
intentional skip message instead of leaving branch protection waiting for
106-
missing checks. If the pull request does include test-sensitive changes, the
107-
matrix runs even when the newest commit is only the generated wiki pointer.
108-
109-
Test workflow concurrency cancels older in-progress runs for the same pull
110-
request. Because the skip decision uses the effective pull request diff instead
111-
of only the latest commit, a generated wiki-pointer commit still runs the matrix
112-
when the pull request contains source, test, Composer, test-workflow, packaged
113-
test-wrapper, or local-action changes.
100+
The tests workflow therefore triggers on every pull request update without
101+
top-level path filters. This ensures GitHub always creates the required
102+
``Run Tests`` matrix checks for the latest pull request head, including bot
103+
commits that only refresh ``.github/wiki``. Test workflow concurrency cancels
104+
older in-progress runs for the same pull request so the newest commit owns the
105+
required check contexts.
114106

115107
At a high level, the workflows need permission to read repository contents,
116108
write generated preview commits, update pull request comments, and publish Pages

0 commit comments

Comments
 (0)