ramsey / composer-install

:gift: A GitHub Action to streamline installation of PHP dependencies with Composer.
MIT License
233 stars 32 forks source link

GH Actions: re-work the integration tests #221

Closed jrfnl closed 2 years ago

jrfnl commented 2 years ago

Description

GH Actions: re-work the integration tests

This removes three keys from the integration test matrix in favour of adding steps for each of those options to the job.

This means that, in effect, the tests are being run in the same way as previously (clean install), but sequentially in one job instead of in parallel in different builds.

This slims down the number of builds per run from 197 to 29.

GH Actions: run integration tests for additional situations

This adds the tests/fixtures/no-lock-file and tests/fixtures/out-of-sync-lock working directories to the matrix for the integration tests to test these situations more thoroughly on each commit as well.

Fixes #219

(Number of builds per run are now 53)

GH Actions: add extra job for unclean install test

Add a job which tests "unclean" installs, i.e. running the action when there is already a vendor directory and a Composer downloads directory in place.

(Number of builds per run are now 57)

🆕 Composer: require-dev the package used for testing

.. in the root composer.json.

🆕 Tests: update version constraints in test fixtures

... to allow for installing a wider range of versions of the ehime/hello-world package.

Includes locking the version for the with-lock-file test to 1.0.3 so there are higher and lower versions to switch to during the tests and switching the "unclean" test to use that fixture as a base.

Motivation and context

See the discussion in #219

How has this been tested?

By running the action and doing a visual check that the output of various steps match the expected output.

Types of changes

PR checklist

codecov[bot] commented 2 years ago

Codecov Report

Merging #221 (a4633e0) into v2 (f680dac) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##               v2     #221   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files           5        5           
  Lines         117      117           
=======================================
  Hits          115      115           
  Misses          2        2           
jrfnl commented 2 years ago

Note: the new "unclean" test run isn't very effective at the moment as the ehime/hello-world dependency is fixed at 1.0.5. (same applies to the lowest/highest runs for the integration tests)

@ramsey Would you be open to changing the version constraint, either for the root project or for the locked test, to be a more open version constraint like ^1.0.0 with the locked version being at 1.0.3 ? That way lowest/highest would actually have something to do, making the tests more effective.

On a loosely related note: should the require for the root project for the ehime/hello-world package be changed to require-dev ?

ramsey commented 2 years ago

Would you be open to changing the version constraint, either for the root project or for the locked test, to be a more open version constraint like ^1.0.0 with the locked version being at 1.0.3 ? That way lowest/highest would actually have something to do, making the tests more effective.

This sounds good. I don't recall why I fixed it at 1.0.5.

On a loosely related note: should the require for the root project for the ehime/hello-world package be changed to require-dev ?

Yep. It can be moved to require-dev.

Thanks so much for doing this work! 🎉

jrfnl commented 2 years ago

I've updated the PR (including the description) with the additional changes.

Happy to help as this is such a useful action ;-)

jrfnl commented 2 years ago

(Sorry for the push noise, there was a weird hickup in the expect tests (in GHA, not related to these changes), so I pushed a non-change to force the tests to re-run)

ramsey commented 2 years ago

Thank you, Juliette!

jrfnl commented 2 years ago

You're very welcome Ben!