Skip to content

Testing branches and PRs

Finn Lewis edited this page Jun 30, 2020 · 8 revisions

Sometimes we need to test a pull request that requires an installation with composer.

To install the project from scratch, we're running the following command

composer create-project localgovdrupal/localgov-project MY_PROJECT --stability dev --no-cache

This will pull down the localgovdrupal/localgov-project, read the composer.json,

https://github.com/localgovdrupal/localgov_project/blob/master/composer.json

then start to pull dependencies, such as this project.

This repository's composer.json then requires localgov_services

https://github.com/localgovdrupal/localgov/blob/master/composer.json#L20

"localgovdrupal/localgov_services": "dev-master",

Note that the branch is defined in each composer.json.

Branches

If we have a pull request on a specific branch on a specific repository, we might want to test that a full fresh build and install works as expected.

To do this we can creat branches on all repos in the dependency chain and test.

For example, if I want to test that the changes on https://github.com/localgovdrupal/localgov_services/tree/feature/49-sitemap work with the full build, I can do the following.

  1. Make a branch with altered composer.json in the parent repository.

In this case, it is the installation profile that requires the localgov_services module. In the installation profile we create a branch of the same name feature/49-sitemap and make the changes to composer.json.

In composer.json, when requiring localgov_services, we specify "dev-feature/49-sitemap" rather than "dev-master" as the branch to check out the desired branch.

"localgovdrupal/localgov_services": "dev-feature/49-sitemap",

  1. Do the same with the next repo up the chain.

It is the root project that requires the installation profile, so we can do the same there.

Create a branch with the same name, feature/49-sitemap. Change the composer.json to require the feature/49-sitemap branch of the installation profile.

Clone this wiki locally