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

Run PHPCS in CI for FSE plugin #43458

Merged
merged 24 commits into from
Jun 19, 2020
Merged

Run PHPCS in CI for FSE plugin #43458

merged 24 commits into from
Jun 19, 2020

Conversation

noahtallen
Copy link
Contributor

@noahtallen noahtallen commented Jun 18, 2020

Changes proposed in this Pull Request

  • Run phpcs lint check on changed files in the FSE plugin
  • Expand FSE plugin GH workflow to run on changes to yarn lock file and to apps/full-site-editing

Testing instructions

  • Lint check should work and should fail on errors

I verified that this does the following:

  1. Fails when a change to a PHP file is not formatted correctly
  2. Does not try to lint non-php files
  3. Runs on changes to yarn.lock

@noahtallen noahtallen requested a review from a team as a code owner June 18, 2020 19:08
@matticbot
Copy link
Contributor

@noahtallen noahtallen self-assigned this Jun 18, 2020
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

Caution: This PR affects files in the FSE Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D45154-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2

Copy link
Contributor

@Addison-Stavlo Addison-Stavlo left a comment

Choose a reason for hiding this comment

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

This is great! And the PR even tests itself from what it looks like? 😆

Screen Shot 2020-06-18 at 4 30 47 PM

Screen Shot 2020-06-18 at 4 30 35 PM

@noahtallen noahtallen requested a review from a team as a code owner June 18, 2020 20:43
paths:
- 'apps/full-site-editing/full-site-editing-plugin/**'
- 'apps/full-site-editing/**'
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if we should build and sync diff creation for things outside of actual plugin folder. 🤔 It probably won't cause issues since we only merge version bump PRs anyway. Another option would be to isolate the changes here in a separate workflow file with these broader matchers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That might be possible. IMO, we should be running:

  • yarn build
  • phpunit
  • phpcs

to any change in apps/full-site-editing (e.g. to pick up on config changes). And on changes to yarn-lock.

IMO the sync diff is the exception 🤔 I wonder if we can restrict a job based on the path itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we should build and sync diff creation for things outside of actual plugin folder. It probably won't cause issues since we only merge version bump PRs anyway.

Yeah, and there's currently not a lot of files in apps/full-site-editing/ (outside of apps/full-site-editing/full-site-editing-plugin), so the overhead shouldn't be too bad.

Another option would be to isolate the changes here in a separate workflow file with these broader matchers.

That might make sense in the long run.

Personally, I wouldn't block merging this PR on that -- I think it's important to get PHPCS into CI, and we can tweak and iterate how we do it later.

Copy link
Member

Choose a reason for hiding this comment

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

IMO the sync diff is the exception 🤔 I wonder if we can restrict a job based on the path itself.

Afaik that hasn't been introduced in GH actions proper yet, although I've seen some 3rd party actions for it (I would rather avoid that dependency).

Copy link
Member

Choose a reason for hiding this comment

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

I don't consider this a blocker either, just a possible future improvement.

@ockham
Copy link
Contributor

ockham commented Jun 18, 2020

This is great! And the PR even tests itself from what it looks like?

Screen Shot 2020-06-18 at 4 30 47 PM

Screen Shot 2020-06-18 at 4 30 35 PM

Only way to test it 😎

yarn.lock Outdated
@@ -1,4 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. ars
Copy link
Contributor

Choose a reason for hiding this comment

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

🍑

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol

Copy link
Contributor

@ockham ockham left a comment

Choose a reason for hiding this comment

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

Thanks! This is going to be very valuable for FSE.

There's been a few good suggestions on this PR, but I think it's important to get PHPCS into CI soon. We can then tweak it in later iterations.

@noahtallen noahtallen changed the title Run PHPCS in github action Run PHPCS in CI for FSE plugin Jun 19, 2020
@noahtallen noahtallen merged commit 29b52c4 into master Jun 19, 2020
@noahtallen noahtallen deleted the try/phpcs-in-gh-action branch June 19, 2020 00:21
paths:
- 'apps/full-site-editing/full-site-editing-plugin/**'
- 'apps/full-site-editing/**'
- 'yarn.lock'
Copy link
Member

Choose a reason for hiding this comment

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

It turns out that this match is too broad and it will trigger on PRs that are not related to FSE plugin. For example see D45192-code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll file a PR to remove it 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

ockham added a commit that referenced this pull request Jun 19, 2020
Addresses #43458 (comment): In #43458, we added a job to PHPCS lint any changed files in the FSE plugin directory. Additionally, we started triggering that action (that's also in charge of creating the FSE diff for WP.com) upon changes to `yarn.lock`.

Turns out that this is too broad a criterion, since `yarn.lock` will change everytime e.g. a Renovate PR is created -- thus creating those FSE diffs too often. While we can consider triggering diff generation upon npm dependency changes, that is an orthogonal change to adding PHPCS linting, so IMO it's fine to remove it -- it's not a regression over the GH Action's state prior to #43458.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants