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
2 changes: 1 addition & 1 deletion .github/wiki
Submodule wiki updated from 716f76 to 6176cf
2 changes: 1 addition & 1 deletion .github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:

- name: Fix permissions
run: |
chmod -c -R +rX "${REPORTS_TARGET}/" | while read line; do
chmod -c -R +rX "${REPORTS_TARGET}/" | while IFS= read -r line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
Expand Down
48 changes: 33 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
name: Run Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.resolve_php.outputs.test-matrix) }}
env:
TESTS_ROOT_VERSION: ${{ github.event_name == 'pull_request' && format('dev-{0}', github.event.pull_request.head.ref) || 'dev-main' }}
Expand Down Expand Up @@ -119,6 +120,31 @@ jobs:
COMPOSER_ROOT_VERSION: ${{ env.TESTS_ROOT_VERSION }}
run: composer dev-tools tests -- --coverage=.dev-tools/coverage --min-coverage=${{ steps.minimum-coverage.outputs.value }}

- name: Publish required test status
if: ${{ always() && inputs.publish-required-statuses }}
env:
GH_TOKEN: ${{ github.token }}
TARGET_SHA: ${{ github.sha }}
TARGET_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TEST_CONTEXT: Run Tests (${{ matrix.php-version }})
TEST_RESULT: ${{ job.status }}
run: |
if [ "${TEST_RESULT}" = "success" ]; then
state="success"
description="Workflow-dispatched PHPUnit job passed."
else
state="failure"
description="Workflow-dispatched PHPUnit job result: ${TEST_RESULT}."
fi

gh api \
--method POST \
"repos/${GITHUB_REPOSITORY}/statuses/${TARGET_SHA}" \
-f state="${state}" \
-f context="${TEST_CONTEXT}" \
-f description="${description}" \
-f target_url="${TARGET_URL}"

dependency-health:
needs: resolve_php
name: Dependency Health
Expand Down Expand Up @@ -184,30 +210,22 @@ jobs:
if: ${{ always() && inputs.publish-required-statuses }}
name: Publish Required Test Statuses
needs:
- tests
- resolve_php
runs-on: ubuntu-latest
steps:
- name: Mirror required test matrix contexts
- name: Publish pending required test statuses
env:
GH_TOKEN: ${{ github.token }}
TARGET_SHA: ${{ github.sha }}
TARGET_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TESTS_RESULT: ${{ needs.tests.result }}
TEST_MATRIX: ${{ needs.resolve_php.outputs.test-matrix }}
run: |
if [ "${TESTS_RESULT}" = "success" ]; then
state="success"
description="Workflow-dispatched PHPUnit matrix passed."
else
state="failure"
description="Workflow-dispatched PHPUnit matrix result: ${TESTS_RESULT}."
fi

for context in "Run Tests (8.3)" "Run Tests (8.4)" "Run Tests (8.5)"; do
php -r "foreach (json_decode(getenv('TEST_MATRIX'), true, 512, JSON_THROW_ON_ERROR)['php-version'] as \$version) { echo \$version, PHP_EOL; }" | while IFS= read -r php_version; do
gh api \
--method POST \
"repos/${GITHUB_REPOSITORY}/statuses/${TARGET_SHA}" \
-f state="${state}" \
-f context="${context}" \
-f description="${description}" \
-f state="pending" \
-f context="Run Tests (${php_version})" \
-f description="Workflow-dispatched PHPUnit job is pending." \
-f target_url="${TARGET_URL}"
done
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Keep the reports workflow permission warning loop shell-safe for paths containing backslashes (#244)
- 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)
- Publish pending and per-version required PHPUnit statuses for workflow-dispatched test runs so wiki pointer commits do not wait for an all-matrix aggregate status (#230)
- Ignore intentional Composer Dependency Analyser shadow dependency findings by default while adding `dependencies --show-shadow-dependencies` for audits (#233)
- Dispatch the required test workflow after wiki preview automation updates a pull-request `.github/wiki` pointer, avoiding permanently pending required checks on bot-authored pointer commits (#230)
- Mirror workflow-dispatched wiki pointer test results into required `Run Tests` commit statuses so branch protection recognizes bot-authored pointer commits (#230)
Expand Down
10 changes: 6 additions & 4 deletions docs/advanced/branch-protection-and-bot-commits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ a parent-repository pointer update, it explicitly dispatches ``tests.yml`` for
the pull request head branch so the newest bot-authored commit receives the
required ``Run Tests`` matrix checks. Because manually dispatched workflow check
runs are not always treated as pull-request required checks, that dispatched
test run also mirrors the matrix result into commit statuses named
``Run Tests (8.3)``, ``Run Tests (8.4)``, and ``Run Tests (8.5)``. Test workflow
concurrency cancels older in-progress runs for the same pull request so the
newest commit owns the required check contexts.
test run first publishes pending commit statuses for the resolved PHP matrix and
then lets each matrix job publish its own final status. The status contexts use
the same required-check names, such as ``Run Tests (8.3)``, ``Run Tests (8.4)``,
and ``Run Tests (8.5)``. Test workflow concurrency cancels older in-progress
runs for the same pull request so the newest commit owns the required check
contexts.

The predictable-conflict workflow MAY also refresh pull request branches when
the only conflicts are ``.github/wiki`` pointer drift and/or ``CHANGELOG.md``
Expand Down
Loading