Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
Reduce CI cost and latency across the reusable workflows#274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
977e729
Stop the workflow sync from overlapping itself
claude cca7c24
Keep the soft-failing test legs off the pull request path
claude d24e7a9
Trim per-job overhead in the reusable test and quality workflows
claude 3766bc4
Skip the test matrix for documentation-only changes
claude 5b96c48
Group the test legs by PHP version in the run view
claude 3c757a2
Address review feedback
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -25,20 +25,30 @@ on: | ||
| required: false | ||
| default: false | ||
| os: | ||
| description: 'Runner to use. Defaults to ubuntu-22.04, or the RUNNERS_NAME repository variable when set.' | ||
| type: string | ||
| required: false | ||
| default: 'ubuntu-22.04' | ||
| default: '' | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| functional: | ||
| name: Behat | PHP ${{ inputs.php }} | WP ${{ inputs.wp }} | ${{ inputs.dbtype == 'sqlite' && 'SQLite' || inputs.dbtype == 'mariadb' && 'MariaDB' || 'MySQL' }}${{ inputs.object_cache == 'sqlite' && ' (Obj Cache)' || '' }}${{ inputs.coverage && ' (with coverage)' || '' }}${{ startsWith( inputs.os, 'windows' ) && ' (Windows)' || '' }}${{ startsWith( inputs.os, 'macos' ) && ' (macOS)' || '' }} | ||
| runs-on: ${{ inputs.os || 'ubuntu-22.04' }} | ||
| # The calling job already states "Behat | PHP x" and groups on it, so this only | ||
| # needs to identify the leg within that group. The database version is spelled | ||
| # out because "MySQL" alone rendered the mysql-8.0 and mysql-8.4 legs | ||
| # identically. | ||
| name: WP ${{ inputs.wp }} | ${{ inputs.dbtype == 'sqlite' && 'SQLite' || inputs.mysql || 'MySQL' }}${{ inputs.object_cache == 'sqlite' && ' (Obj Cache)' || '' }}${{ inputs.coverage && ' (with coverage)' || '' }}${{ startsWith( inputs.os, 'windows' ) && ' (Windows)' || '' }}${{ startsWith( inputs.os, 'macos' ) && ' (macOS)' || '' }} | ||
| # Repositories with a heavy Behat suite can point the default Linux legs at a | ||
| # larger runner by setting the `RUNNERS_NAME` repository variable, without | ||
| # having to fork this workflow. Explicit macOS/Windows legs are unaffected. | ||
| runs-on: ${{ inputs.os || vars.RUNNERS_NAME || 'ubuntu-22.04' }} | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| continue-on-error: ${{ inputs.dbtype == 'mariadb' || inputs.php == 'nightly' || startsWith( inputs.os, 'windows' ) || startsWith( inputs.os, 'macos' ) }} | ||
| timeout-minutes: ${{ ( startsWith( inputs.os, 'windows' ) || startsWith( inputs.os, 'macos' ) ) && 120 || inputs.coverage && 90 || 60 }} | ||
| env: | ||
| MYSQL_HOST: 127.0.0.1 | ||
| MYSQL_TCP_PORT: 3306 | ||
| @@ -77,10 +87,21 @@ jobs: | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | ||
swissspidy marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # Ghostscript ships with the GitHub-hosted images, so the `apt-get update` | ||
| # this used to run unconditionally cost every Behat leg ~25s for a package | ||
| # that was already there. Keep the install as a fallback in case a future | ||
| # image drops it. | ||
| - name: Install Ghostscript | ||
| if: ${{ inputs.os == 'ubuntu-22.04' || inputs.os == '' }} | ||
| # Keyed on the actual runner rather than the `os` input: an empty input no | ||
| # longer implies ubuntu-22.04 now that RUNNERS_NAME can select the image. | ||
| if: ${{ runner.os == 'Linux' }} | ||
| run: | | ||
| if command -v gs > /dev/null 2>&1; then | ||
| echo "Ghostscript $(gs --version) is already installed; skipping." | ||
| exit 0 | ||
| fi | ||
| sudo apt-get update | ||
| sudo apt-get install ghostscript -y | ||
| @@ -90,7 +111,12 @@ jobs: | ||
| - name: Install dependencies (macOS) | ||
| if: ${{ startsWith(inputs.os, 'macos') }} | ||
| run: brew install ghostscript | ||
| run: | | ||
| if command -v gs > /dev/null 2>&1; then | ||
| echo "Ghostscript $(gs --version) is already installed; skipping." | ||
| exit 0 | ||
| fi | ||
| brew install ghostscript | ||
| - name: Set up PHP environment | ||
| uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 | ||
| @@ -104,12 +130,31 @@ jobs: | ||
| COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Change ImageMagick policy to allow pdf->png conversion. | ||
| if: ${{ inputs.os == 'ubuntu-22.04' || inputs.os == '' }} | ||
| # Keyed on the actual runner rather than the `os` input, and tolerant of | ||
| # images that ship a different ImageMagick layout — `sed -i` on a missing | ||
| # file exits non-zero and would fail the leg. | ||
| if: ${{ runner.os == 'Linux' }} | ||
| run: | | ||
| sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml | ||
| if [ -f /etc/ImageMagick-6/policy.xml ]; then | ||
| sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml | ||
| else | ||
| echo 'No ImageMagick 6 policy file found; nothing to relax.' | ||
| fi | ||
| # WP-CLI packages do not commit a lock file, so `composer update` resolves | ||
| # dependencies on every run while the cache key stays pinned to composer.json. | ||
| # Rotating the suffix weekly stops `dev-*` requirements from being served out | ||
| # of an indefinitely stale cache. `%Y-%W` is portable across the GNU, BSD and | ||
| # Git-for-Windows implementations of `date`. | ||
| - name: Determine the weekly Composer cache suffix | ||
| id: composer-cache-suffix | ||
| shell: bash | ||
| run: echo "value=$(date -u +%Y-%W)" >> "$GITHUB_OUTPUT" | ||
| - name: Install Composer dependencies & cache dependencies | ||
| uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0 | ||
| with: | ||
| custom-cache-suffix: ${{ steps.composer-cache-suffix.outputs.value }} | ||
| env: | ||
| COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.