Skip to content

Add validation of the composer files on Travis #653

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

Merged
merged 3 commits into from
Sep 20, 2017

Conversation

stof
Copy link
Member

@stof stof commented Sep 20, 2017

This performs validation of the composer metadata to ensure they are valid:

  • composer.json does not contain any error
  • composer.json does not trigger any warning (thanks to the strict mode)
  • composer.lock is uptodate

This performs validation of the composer metadata to ensure they are valid:

- composer.json does not contain any error
- composer.json does not trigger any warning (thanks to the strict mode)
- composer.lock is uptodate
@stof
Copy link
Member Author

stof commented Sep 20, 2017

this will avoid mistakes like what happened in #650 where the lock file was not updated with composer update --lock) (moving deps to dev deps or the opposite does not require changing the version of deps, but it impacts the lock file and composer was displaying a warning about outdated lock file when running composer install)

@stof
Copy link
Member Author

stof commented Sep 20, 2017

Note that I added this on Travis only.
Running this on both Travis and Appveyor is useless (the validator does not execute any of our code, and the JSON content will be the same on Windows and Linux).

And Travis collapses the installation instruction so it is easier to reach the test output

@javiereguiluz
Copy link
Member

@stof thanks for adding this useful check and for explaining it perfectly!

@javiereguiluz javiereguiluz merged commit 5deb547 into symfony:master Sep 20, 2017
javiereguiluz added a commit that referenced this pull request Sep 20, 2017
…ereguiluz)

This PR was merged into the master branch.

Discussion
----------

Add validation of the composer files on Travis

This performs validation of the composer metadata to ensure they are valid:

- composer.json does not contain any error
- composer.json does not trigger any warning (thanks to the strict mode)
- composer.lock is uptodate

Commits
-------

5deb547 Minor change to make things consistent
2493692 Update lock file for the move of deps to dev deps
99246aa Add validation of the composer files on Travis
@stof stof deleted the validate_composer branch September 20, 2017 17:26
@stof
Copy link
Member Author

stof commented Sep 20, 2017

Note that there is a few variation of the command to add on CI depending on the project:

  • if the project is not meant to be published on Packagist (or in a private registry), you can add --no-check-publish to avoid requiring a name and description if you don't have them. Libraries registered on Packagist should never use this flag.
  • if the repo does not commit the lock file (which should only happen for libraries), you may want to add --no-check-lock to skip useless validation (if the composer.lock was generated by the CI job itself when running composer update, the lock file will never be outdated, and if it is due to a composer bug, you cannot fix the lock file anyway)

Note that Packagist validates the composer.json before accepting updates, so an invalid one might prevent the new commit to become visible to users.

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.

2 participants