We extensively use https://github.com/bamarni/composer-bin-plugin to manage dev dependencies to avoid conflicts and dependencies hells.
bamarni/composer-bin-plugin requires to use the argument bin before the Composer's argument.
Something like:
composer bin [folder] install
composer bin [folder] update
Currently it is not possible to use this action in conjunction with bamarni/composer-bin-plugin as it is not possible to prepend bin [folder] to the actual Composer's command (install/update).
What we tested
We tried to directly call the action in the folders where the composer-bin composer.json files reside:
...
- name: Install Composer bin PHPunit
uses: ramsey/composer-install@v2
with:
working-directory: "vendor-bin/phpunit"
- name: Run PHPunit
run: |
vendor/bin/simple-phpunit
...
Unfortunately this doesn't work as the executable is not moved to the main vendor/bin folder and so it doesn't exist there.
So, we thought we could change the step to actually call the executable directly from the vendor-bin/[folder]:
...
- name: Install Composer bin PHPunit
uses: ramsey/composer-install@v2
with:
working-directory: "vendor-bin/phpunit"
- name: Run PHPunit
run: |
- vendor/bin/simple-phpunit
+ vendor-bin/phpunit/vendor/bin/simple-phpunit
...
Unfortunately this also doesn't work as not all classes are dumped in the autoload, mainly the ones of the project: bamarni/composer-bin-plugin, in facts, merges all the classes from the autoload key in the root composer.json with the ones found in the various bin subfolders in one autoload file, so it is possible to maintain all the dependencies separate, but anyway using them as if they were all installed in the root composer.json.
Obviously, it also has a mechanism to avoid conflicts (but this mechanism is not related to this issue, so I'm skipping it).
Proposal/solution
I think the besto solution is to directly support bamarni/composer-bin-plugin, allowing to set a key for it with the name of the folder in which is the composer.json file to install.
So, continuing with the previous PHPUnit example and assuming the composer.json file we want to install is in vendor-bin/phpunit/composer.json, then we could configure the action with something like this:
- name: Install Composer bin PHPunit
uses: ramsey/composer-install@v2
with:
bin: "phpunit"
We extensively use https://github.com/bamarni/composer-bin-plugin to manage dev dependencies to avoid conflicts and dependencies hells.
bamarni/composer-bin-pluginrequires to use the argumentbinbefore the Composer's argument.Something like:
composer bin [folder] installcomposer bin [folder] updateCurrently it is not possible to use this action in conjunction with
bamarni/composer-bin-pluginas it is not possible to prependbin [folder]to the actual Composer's command (install/update).What we tested
We tried to directly call the action in the folders where the
composer-bincomposer.jsonfiles reside:... - name: Install Composer bin PHPunit uses: ramsey/composer-install@v2 with: working-directory: "vendor-bin/phpunit" - name: Run PHPunit run: | vendor/bin/simple-phpunit ...Unfortunately this doesn't work as the executable is not moved to the main
vendor/binfolder and so it doesn't exist there.So, we thought we could change the
stepto actually call the executable directly from thevendor-bin/[folder]:... - name: Install Composer bin PHPunit uses: ramsey/composer-install@v2 with: working-directory: "vendor-bin/phpunit" - name: Run PHPunit run: | - vendor/bin/simple-phpunit + vendor-bin/phpunit/vendor/bin/simple-phpunit ...Unfortunately this also doesn't work as not all classes are dumped in the autoload, mainly the ones of the project:
bamarni/composer-bin-plugin, in facts, merges all the classes from theautoloadkey in the rootcomposer.jsonwith the ones found in the variousbinsubfolders in one autoload file, so it is possible to maintain all the dependencies separate, but anyway using them as if they were all installed in the rootcomposer.json.Obviously, it also has a mechanism to avoid conflicts (but this mechanism is not related to this issue, so I'm skipping it).
Proposal/solution
I think the besto solution is to directly support
bamarni/composer-bin-plugin, allowing to set a key for it with the name of the folder in which is thecomposer.jsonfile to install.So, continuing with the previous PHPUnit example and assuming the
composer.jsonfile we want to install is invendor-bin/phpunit/composer.json, then we could configure the action with something like this: