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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add workflow for GitHub Actions #153

Merged
merged 1 commit into from
Feb 6, 2020

Conversation

localheinz
Copy link
Contributor

This PR

  • adds a workflow for GitHub Actions

馃拋鈥嶁檪 Not sure if this matches the expectations - I have tried to create a workflow with jobs equivalent to the stages currently used on Travis CI. Note that the actions will not be triggered here as I do not have push privileges (that's why I'm still leaving the Travis CI integration as it is).

@localheinz
Copy link
Contributor Author

/cc @alcaeus

@localheinz localheinz force-pushed the feature/github-actions branch 3 times, most recently from 809b3e4 to b068f49 Compare January 29, 2020 20:18
- name: "Checkout"
uses: "actions/checkout@v2.0.0"

- name: "Build Docker image"
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 step isn't actually necessary, but it makes it obvious that the Docker image needs to be build.

Otherwise, the build time will be attributed to the next step (where the Docker image is used).

Choose a reason for hiding this comment

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

very nice

strategy:
matrix:
php-version:
- "7.2"
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, do you think it is necessary to actually run phpcs on 7.3, 7.4, and 8.0?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure, but maybe when a sniff belongs to code only valid beginning with a certain PHP version.

Copy link
Member

@morozov morozov Jan 30, 2020

Choose a reason for hiding this comment

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

I believe the target PHP version should be expressed in the configuration of the standard in the project that implements it. See an example.

Static analysis should not produce different results with different runtimes, so more than one PHP version shouldn't be necessary.

Copy link
Member

Choose a reason for hiding this comment

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

With previous discussion regarding version-dependent functionality (e.g. native type hints, see #144), testing gets quite complicated. The main build should test against the lowest supported version, which is 7.2.

However, our standard produces different results when running on different PHP versions. There is a mechanism with a patch file that allows for running on PHP 7.4 as well, but I feel that maintaining this mechanism for multiple versions will be quite cumbersome. However, changing this would be a policy change that should not be discussed in this PR.

So for now I'm fine running this only on 7.2. Before replacing our travis-ci builds with GitHub Actions, we should discuss the issue of running on separate versions separately.

@SenseException
Copy link
Member

Thank you for contributing for the Github Action implementation. 馃憤

branches:
- "master"
schedule:
- cron: "0 17 * * *"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen Shot 2020-01-29 at 22 57 59

Looks like there's a cronjob scheduled to run once a day, doesn't it?

Copy link
Member

Choose a reason for hiding this comment

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

Currently, the master branch is run every day. I'm fine running the master branch daily, but would prefer if we can also add the latest stable branch (7.0.x at the moment) every week.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe that this is currently not possible, see https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule:

You can schedule a workflow to run at specific UTC times using POSIX cron syntax. Scheduled workflows run on the latest commit on the default or base branch. The shortest interval you can run scheduled workflows is once every 5 minutes.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. That's fine for now :)

.github/workflows/continuous-integration.yml Outdated Show resolved Hide resolved
.github/workflows/continuous-integration.yml Outdated Show resolved Hide resolved
@localheinz localheinz marked this pull request as ready for review January 30, 2020 15:45
alcaeus
alcaeus previously approved these changes Feb 5, 2020
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Thanks for contributing this @localheinz! I'm in favour of getting this merged to see if GitHub Actions can replace travis-ci in the foreseeable future 馃帀

@alcaeus alcaeus requested a review from a team February 5, 2020 08:08
@localheinz
Copy link
Contributor Author

Thank you, @alcaeus!

In case this doesn't work as expected once merged, I'll be available to quickly circle back and fix issues!

greg0ire
greg0ire previously approved these changes Feb 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.

Looks great, but we don't know if this actually works until we merge, correct? If yes, can you please enable github actions on your fork and post a link to the results here?

@alcaeus
Copy link
Member

alcaeus commented Feb 5, 2020

@greg0ire since we currently don't require the tests to pass at all, I think it's ok to merge this and fix afterwards.

@alcaeus alcaeus requested a review from a team February 5, 2020 09:47
@greg0ire
Copy link
Member

greg0ire commented Feb 5, 2020

Might be ok indeed, especially since that repo is not the most active, we will not confuse many contributors by doing so.

SenseException
SenseException previously approved these changes Feb 5, 2020
Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

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

馃憤

@alcaeus alcaeus requested a review from a team February 5, 2020 13:24
@greg0ire
Copy link
Member

greg0ire commented Feb 5, 2020

I did the setup in case anyone wants to see: greg0ire#1

- "7.2"
- "7.3"
- "7.4"
- "8.0"
Copy link
Member

Choose a reason for hiding this comment

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

This one fails for now but should be fixed by #156

@localheinz
Copy link
Contributor Author

@greg0ire

I have opened a pull request against my fork - perhaps a bit easier than having to update your branch: localheinz#1.

@localheinz
Copy link
Contributor Author

@alcaeus @greg0ire @morozov @SenseException @simPod

Apart from the unrelated build failure (see #153 (comment)), the build passes now:

https://github.com/localheinz/coding-standard/pull/1/checks

Copy link
Contributor

@simPod simPod left a comment

Choose a reason for hiding this comment

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

Have nothing to add, LGTM!

@SenseException
Copy link
Member

@localheinz
Copy link
Contributor Author

localheinz commented Feb 6, 2020

@alcaeus alcaeus merged commit c552c9b into doctrine:master Feb 6, 2020
@alcaeus
Copy link
Member

alcaeus commented Feb 6, 2020

Thanks @localheinz! 馃帀

uses: "actions/checkout@v2.0.0"

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
Copy link

@bendavies bendavies Feb 6, 2020

Choose a reason for hiding this comment

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

i've said this before but i'm very much against this being used when docker containers are available.
docker makes it var easier for developers to replicate results locally.

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's true, let's which direction we are taking here.

On the other hand, with Docker images we have the following issues:

  • Docker images need to be mantained
  • Docker images need to be built (either inline when running the job, which adds significant overhead, or built and tagged elsewhere, then downloaded)

I'm sure we'll be able to tweak things here and there!

Choose a reason for hiding this comment

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

Hey!

Thanks for the reply.

I think I could say exactly the same about shivammathur/setup-php :)

  • It is highly complex and maintenance is outside of our control here. We can either control Dockerfiles or use official php ones in most cases. I would trust official php docker images over shivammathur/setup-php.
  • shivammathur/setup-php has significant overhead. It can take 25 seconds to install php, while pulling php:7.4-cli-alpine3.11 takes only 6 seconds for example, in a quick test.
  • As mentioned, i think the biggest thing is local reproducibility of build results.

Cheers!

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure one needs Docker to run this locally or? Its just php vendor/bin/phpcs, it doesn't have any dependencies or complexities to run.

@localheinz
Copy link
Contributor Author

Thank you, @alcaeus, @bendavies, @greg0ire, @malarzm, @morozov, @SenseException, and @simPod!

@localheinz localheinz deleted the feature/github-actions branch February 14, 2020 18:20
@greg0ire
Copy link
Member

greg0ire commented Sep 9, 2020

@localheinz should we drop Travis ? Looks like you pretty much migrated everything to Github actions?

@localheinz
Copy link
Contributor Author

@greg0ire

馃憤 Drop it!

@greg0ire
Copy link
Member

greg0ire commented Sep 9, 2020

See #220 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants