Skip to content
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

Allow for required GHA job statuses to be reported so that all PR checks have a status #6378

Merged
merged 39 commits into from
Jun 17, 2021

Conversation

pierlon
Copy link
Contributor

@pierlon pierlon commented Jun 13, 2021

Summary

One issue we've been having with required GHA jobs is that whenever their statuses are not reported (due to a workflow not running because a modified file does not match the configured paths or paths-ignore glob patterns, for example), it prevents PR auto-merging from occurring as all the required PR checks have not reported a status. Instead, these required GHA jobs are forever left in a pending state for which a status will never be reported. An example:

image

This PR attempts to resolve this issue by removing these paths and paths-ignore glob patterns from the build-test-measure.yml and qa-integrate.yml workflows, and instead adds a "pre-run" job that replicates the feature. The job retrieves the list of modified files from the PR (or previous commit if not a PR), and then uses a pre-defined regex pattern to detect the modified files related to the workflow. If there is at least one match, the workflow run continues, and if not, the rest of the workflow is skipped and the required jobs will be given a "skipped" status.

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@pierlon pierlon force-pushed the make-required-pr-checks-optional branch from d2cc311 to 8689607 Compare June 13, 2021 07:59
@pierlon pierlon changed the title Only run workflow jobs if permitted files have changed Allow for required GHA job statuses to be reported so that all PR checks can be reported Jun 13, 2021
@pierlon pierlon changed the title Allow for required GHA job statuses to be reported so that all PR checks can be reported Allow for required GHA job statuses to be reported so that all PR checks have a status Jun 13, 2021
@pierlon pierlon self-assigned this Jun 14, 2021
@pierlon pierlon added the Infrastructure Changes impacting testing infrastructure or build tooling label Jun 14, 2021
@pierlon pierlon added this to the v2.2 milestone Jun 14, 2021
@pierlon pierlon marked this pull request as ready for review June 14, 2021 04:38
@github-actions
Copy link
Contributor

github-actions bot commented Jun 14, 2021

QA tester plugin build for 1cb101c is ready 🛎️!
Download the build

@github-actions
Copy link
Contributor

github-actions bot commented Jun 14, 2021

Plugin builds for 1ba9c2e are ready 🛎️!

name: 'Pre run'
runs-on: ubuntu-latest
outputs:
changed-file-count: ${{ steps.determine-file-count.outputs.count }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea: what if there was a changed-php-file-count, changed-css-file-count, and changed-js-file-count? Then lint-css could, for example, only run if needs.pre-run.outputs.changed-css-file-count > 0. Same for the others. This would speed up the runs a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me gusta. I'll make the change.

@pierlon pierlon force-pushed the make-required-pr-checks-optional branch from 1b114a8 to 2f8e444 Compare June 17, 2021 01:24
@pierlon pierlon requested a review from westonruter June 17, 2021 01:47
@@ -258,6 +315,8 @@ jobs:

e2e-test-js:
name: 'E2E test: JS'
needs: pre-run
if: needs.pre-run.outputs.changed-file-count > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we'd want to make this check for modified files too strict, as this touches multiple sections of the plugin.

@@ -334,6 +393,8 @@ jobs:
unit-test-php:
name: "Unit test${{ matrix.coverage && ' (with coverage)' || '' }}: PHP ${{ matrix.php }}, WP ${{ matrix.wp }}"
runs-on: ubuntu-latest
needs: pre-run
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same sentiment here.

@@ -504,6 +565,8 @@ jobs:

feature-test-php:
name: "Feature test${{ matrix.coverage && ' (with coverage)' || '' }}: PHP ${{ matrix.php }}, WP ${{ matrix.wp }}"
needs: pre-run
if: needs.pre-run.outputs.changed-file-count > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same sentiment here.

@@ -138,7 +202,8 @@ jobs:
unit-test-php:
name: 'Unit test: PHP (v${{ matrix.php }})'
runs-on: ubuntu-latest
needs: [lint-css, lint-js, lint-php]
needs: pre-run
if: needs.pre-run.outputs.changed-file-count > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same sentiment here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concern being that a PHPUnit test may load a CSS file or a JS file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Comment on lines -288 to +354
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
uses: google-github-actions/setup-gcloud@master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, why the switch here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westonruter westonruter merged commit 4e9ddcb into develop Jun 17, 2021
@westonruter westonruter deleted the make-required-pr-checks-optional branch June 17, 2021 04:21
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes. Infrastructure Changes impacting testing infrastructure or build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants