localgovdrupal / localgov_shared_workflows

GNU General Public License v2.0
0 stars 0 forks source link

New test failure on 1.8.x PR for alert banner #6

Closed andybroomfield closed 4 weeks ago

andybroomfield commented 1 month ago

See https://github.com/localgovdrupal/localgov_alert_banner/actions/runs/10265473963/job/28406315876?pr=338

Root composer.json requires localgovdrupal/localgov_alert_banner dev-1.8.x as 1.7.8, found localgovdrupal/localgov_alert_banner[dev-fix/typo-in-cache-context-name, ..., dev-245_alert_banner_with_empty_link_text_should_show_more_information_but_nothing_shows, 1.0.0-alpha1, ..., 1.x-dev] but it does not match the constraint.

millnut commented 1 month ago

Thanks @andybroomfield I think when a branch is a version number the require should look like this which we need to look into;

composer --working-dir=./html require --with-all-dependencies localgovdrupal/localgov_alert_banner:"1.8.x-dev as 1.7.8"

whereas we currently do this which works fine for feature branches but doesn't for version number branches:

composer --working-dir=./html require --with-all-dependencies localgovdrupal/localgov_alert_banner:"dev-1.8.x as 1.7.8"

So dev- prefix is only for named/feature branches, not for version numbers which should be like 1.8.x-dev

I wonder if this is because it is seeing the github.ref as refs/pull/338/merge so falls into the step Set composer branch reference for non-version branches which then sets the composer ref as dev-1.8.x rather than 1.8.x-dev

Maybe tweaking the two steps like this would work:

      - name: Set composer branch reference for version branches
        if: endsWith(github.ref, '.x') || endsWith(env.GIT_BRANCH, '.x')
        run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV

      - name: Set composer branch reference for non-version branches
        if: endsWith(github.ref, '.x') == false && endsWith(env.GIT_BRANCH, '.x') == false
        run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV

cc @stephen-cox for his thoughts on this also

andybroomfield commented 1 month ago

It's now looking like feature branches are no longer able to install https://github.com/localgovdrupal/localgov_alert_banner/actions/runs/10348949039/job/28643317956 This is through a manual run.

Any way to test with #8?

millnut commented 1 month ago

Possibly, you could update that branch to use this shared workflow in a Draft PR:

uses: localgovdrupal/localgov_shared_workflows/.github/workflows/test-module.yml@fix/1.x/6-version-branch-tests-do-not-run

Test it and then revert back before merging

finnlewis commented 1 month ago

I think this is working now @millnut ! Nice one! See https://github.com/localgovdrupal/localgov_alert_banner/pull/338