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

Move phpcs from Travis to GitHub Actions #3979

Merged
merged 5 commits into from
May 6, 2020

Conversation

bendavies
Copy link
Contributor

Q A
Type improvement
BC Break no
Fixed issues

Summary

Moves phpcs from Travis to GitHub Actions.

#3978 needs merging first.

@bendavies bendavies force-pushed the phpcs-github-actions branch 2 times, most recently from bb366de to 05be601 Compare April 28, 2020 20:08
@bendavies bendavies changed the title Phpcs GitHub actions Move phpcs from Travis to GitHub Actions Apr 28, 2020
@bendavies bendavies force-pushed the phpcs-github-actions branch 3 times, most recently from fedae68 to 62a7028 Compare April 28, 2020 20:50
@greg0ire
Copy link
Member

#3978 was merged :)

@bendavies bendavies marked this pull request as ready for review April 29, 2020 21:51
@bendavies bendavies requested a review from greg0ire April 29, 2020 21:51
phpcs.xml.dist Outdated Show resolved Hide resolved
@greg0ire greg0ire requested a review from morozov May 1, 2020 13:24
Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Please add cs2pr, I noticed @beberlei did that on ORM (master branch). I'm doing so in a PR to 2.7: doctrine/orm#8116

@bendavies bendavies requested a review from morozov May 5, 2020 21:00
@bendavies bendavies requested a review from greg0ire May 5, 2020 21:00
@bendavies bendavies force-pushed the phpcs-github-actions branch 2 times, most recently from f1e446a to d034575 Compare May 5, 2020 21:02
greg0ire
greg0ire previously approved these changes May 5, 2020
Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

👌

@greg0ire greg0ire added the CI label May 5, 2020
@morozov
Copy link
Member

morozov commented May 5, 2020

Is there a way to see how cs2pr works in this repository before merging the changes? E.g. push a temporary commit that would violate the coding standard.

@@ -6,28 +6,66 @@ on:

jobs:
static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-latest
name: "Static Analysis with Psalm"
Copy link
Member

Choose a reason for hiding this comment

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

Are changes like this really needed? I'd rather keep it simple and only add quotes where required (e.g. strings with special characters, numeric strings that must remain strings, etc.).

This file will be maintained by humans who will not see the need to add quotes everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is trying to maintain consistency across repos
https://github.com/doctrine/orm/pull/8116/files

Copy link
Member

Choose a reason for hiding this comment

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

So what's the reason why we want to have all strings quoted in all repositories?

Copy link
Contributor Author

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.

it's just coding style, and that repo enforces it:
https://github.com/ergebnis/php-library-template/blob/master/.yamllint.yaml

I personally don't like everything quoted, as you point out it's not necessary all the time. but being consistent is the main thing i guess.

cc @localheinz

Choose a reason for hiding this comment

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

@morozov

I am using ibiqlik/action-yamllint to lint YAML files using yamllint, and for consistency, I quote YAML strings.

As @bendavies pointed out, it's a matter of taste and consistency. I have to admit that I dislike having to escape a bunch of characters when quoting.

with:
path: "~/.composer/cache"
key: "composer-${{ hashFiles('composer.lock') }}"
restore-keys: "composer-"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
Copy link
Member

Choose a reason for hiding this comment

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

This looks like an unnecessary complication. What's the scenario where we're going to run the code style check using different PHP versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has already been discussed. It is trying to maintain consistency across repos
https://github.com/doctrine/orm/pull/8116/files

Copy link
Member

Choose a reason for hiding this comment

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

Could you point me to the thread, please? I could find the discussion regarding the build matrix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@bendavies bendavies May 6, 2020

Choose a reason for hiding this comment

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

sorry, let me elaborate, because that link doesn't help you.

I think, even if the matrix has a single php version, it enables us to use the same key everywhere, which helps cache hits. rather than using

key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"

where a matrix is used and

key: "php-7.4-composer-locked-${{ hashFiles('composer.lock') }}"

where a matrix is not used.

Copy link
Member

Choose a reason for hiding this comment

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

So, by “everywhere” you mean that if named consistently, the same cache entry can be shared between multiple actions? Makes sense in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Multiple action in the same repo yes. Thanks for phrasing it better!

runs-on: "ubuntu-latest"

strategy:
matrix:
Copy link
Member

Choose a reason for hiding this comment

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

I believe the whole point of static analysis is that it's static and doesn't depend on the runtime environment. Having a matrix here looks like overkill to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is trying to maintain consistency across repos
https://github.com/doctrine/orm/pull/8116/files

@morozov
Copy link
Member

morozov commented May 6, 2020

Looks good. Should we test #3979 (comment) and squash everything before the merge?

@bendavies
Copy link
Contributor Author

Sure. I can do it later, or feel free to push to my branch if you are available now.

@greg0ire
Copy link
Member

greg0ire commented May 6, 2020

Looks like it works!
Screenshot_2020-05-06 Move phpcs from Travis to GitHub Actions by bendavies · Pull Request #3979 · doctrine dbal

@greg0ire
Copy link
Member

greg0ire commented May 6, 2020

After merging up all the way until master, let's add this check as well as Psalm as required, shall we?

@greg0ire greg0ire merged commit db5afa2 into doctrine:2.10.x May 6, 2020
@greg0ire
Copy link
Member

greg0ire commented May 6, 2020

Thanks a lot @bendavies !

@greg0ire greg0ire self-assigned this May 7, 2020
@greg0ire greg0ire added this to the 2.10.3 milestone Jun 7, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants