-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add .gitattributes to exclude tests from ZIPs #17995
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
Conversation
…symfony#5674)" This reverts commit b33d5bc.
@@ -0,0 +1,2 @@ | |||
/Tests export-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should also add .git* export-ignore
to ignore the gitattributes and gitignore from the archive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added (also with a check in the phpunit wrapper)
257a802
to
7b77dc8
Compare
if (!$runningProcs) { | ||
echo "Symfony tests are missing, did you get the code from a ZIP file?\n"; | ||
echo "Please use git to fetch the source at https://github.com/symfony/symfony\n"; | ||
exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch the source from?
@@ -119,6 +119,12 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) { | |||
} | |||
chdir($oldPwd); | |||
|
|||
if (!$runningProcs) { | |||
echo "Symfony tests are missing, did you get the code from a ZIP file?\n"; | |||
echo "Please use git to fetch the source from https://github.com/symfony/symfony\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be written to stderr instead
c65d15d
to
01955a5
Compare
83cd775
to
dc4eafa
Compare
PR is ready, comments welcomed. The failure on Travis is related to a limitation of composer that eats all memory when a local packages.json defines a lot of local packages, which is the case here where every single component+bridge+bundle is modified so each of them is locally repackaged for per-components tests. Appveyor failure is unrelated (fixed in #18002) |
Given the 3 other proposals at #17749 (comment) that look way better to me, I convinced myself that this was a bad idea. |
This PR was squashed before being merged into the 2.3 branch (closes #17997). Discussion ---------- Updated all the README files | Q | A | ------------- | --- | Branch | 2.3 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Related to #17995. Commits ------- 2e81248 Updated all the README files
Here is my reasoning pro keeping tests where they are and also in the .zip archives:
In conclusion: I'm all for the status quo, which is the best solution, unless --prefer-source can be made as fast as --prefer-dist (or any other way that would make fetching the tests as fast, see e.g. my email to github support). Meanwhile, I'm all for enhancing editorconfig or any other way to help 1. supporters configure their IDE or clean their filesystem. |
For me prefer-source is faster once you already have the git cloned. |
Here is the response from github (see above for the question):
This isn't currently possible but you could create a release.
This would allow you to create a ZIP file that includes the files the you
want to include:
https://help.github.com/articles/creating-releases/
Also please check the link to editorconfig, it's getting some attention.
|
@nicolas-grekas Could you reconsider this PR? I'm totally with @rdohms comment |
@mlocati this is open source, so I invite you to advocate your ideas :) |
Here's a soluton: composer/composer#5367 |
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (#29277) Added .gitattributes files to root and all components (#26472) Exclude non-essential files from Composer package (#25414) [HttpFoundation] optimize files for distribution (#24427) Add .gitattributes files (#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (#20057) Add lightweight and root only .gitattributes (#18004) Add .gitattributes to exclude tests from ZIPs (#17995) [RFC] Move tests out of the source and source out of the tests (#17749) Removal of development & testing files using .gitattributes (#16174) Please add .gitattributes files and fix line endings (#13521) making use of .gitattributes (#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24 Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
…dist" (Nyholm) This PR was merged into the 4.4 branch. Discussion ---------- Adding .gitattributes to remove Tests directory from "dist" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no? | Tickets | | License | MIT | Doc PR | This is a controversial topic that have been mentioned before. We recently had some discussions on Slack about it and the community not in an agreement. This was asked back in 2014 already. Im making this PR again, because I think this will help more people than it hurts to keep the tests in the "dist" version. ### Reasons for keeping the tests with the source * You can look at the tests to understand how the code works * It is convenient In the past there were an argument of people might depend on Symfony's classes in Tests. That is no longer the case since we moved reusable classes from Tests to Test. ### Reasons for removing them (merging this PR) * There should be difference between `composer update --prefer-source` and `composer update --prefer-dist` * Smaller packages when deploying with Docker or on Serverless. * Static analysis tools will not complain on PHP syntax errors in our tests ([example](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/xml_with_wrong_ext.php)) ## How to decide? Merging this PR or not is tricky because no side has a solid technical argument. It is basically just personal preference. Please give this PR a 👍 or 👎 if you want to give your opinion. ## Other PRs and issues related to this: Add .gitattributes file (symfony/symfony#29277) Added .gitattributes files to root and all components (symfony/symfony#26472) Exclude non-essential files from Composer package (symfony/symfony#25414) [HttpFoundation] optimize files for distribution (symfony/symfony#24427) Add .gitattributes files (symfony/symfony#23926) [Suggestion] Adding .gitattributes to ignore unnecessary folders and files for production env (symfony/symfony#20057) Add lightweight and root only .gitattributes (symfony/symfony#18004) Add .gitattributes to exclude tests from ZIPs (symfony/symfony#17995) [RFC] Move tests out of the source and source out of the tests (symfony/symfony#17749) Removal of development & testing files using .gitattributes (symfony/symfony#16174) Please add .gitattributes files and fix line endings (symfony/symfony#13521) making use of .gitattributes (symfony/symfony#11810) ## Workarounds There are workarounds for both sides. Example: ### Workaround if merged * `composer update --prefer-source` ### Workaround if closed * `find vendor/symfony -name "Tests" -type d -exec rm -r "{}" \;` * editorconfig/editorconfig#228 * https://github.com/dg/composer-cleaner Commits ------- ac7dc24bcb Adding .gitattributes to remove Tests directory from "dist"
In #6605, @fabpot gives 3 args against .gitattributes export-ignore:
I think args 1. and 3. do not apply anymore:
Test/
directories have been created and we do not support extending/using anything inTests/
. In fact not shipping these dirs is a good way to enforce this. For 3., since we do not want PRs on standalone subtree-splits, we should not support running tests without first checking out the main symfony/symfony.Argument 2. could remain, but has to be balanced by arguments presented in #17749.
The resulting zip file (as constructed by github) is 4.3Mb whereas it's 5.7Mb on the current 2.3 (-25%).
Note that I'm personally not in favor of moving Tests/ out of each components directory! Most if not all of the benefits mentioned in #17749 should be achieved already here.
I think we should also open a sibling PR for updating all README.md files: we should not tell about how to test there. But linking to each component's doc in turn would be great (as suggested in #17981).