Comments (14)
As far as I can tell the example depends on cache-files-dir
and the composer.lock
files found, so it should work out of the box already.
Even if there is additional vendors, the downloaded files are cached in the same directory: be it from a global dependency, your project one or a composer-bin-plugin one
from composer-bin-plugin.
hmm I guess you are right, since the composer-bin-plugin does only change the working directory and composer.json but not the cache-files-dir
from composer-bin-plugin.
after a few more tests I can see that it is not enough to configure the regular caching.
e.g. for php-cs-fixer you need something like
- name: Cache php-cs-fixer big dependency tree
uses: actions/cache@v1
with:
path: vendor-bin/php-cs-fixer/vendor/
key: ${{ runner.os }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}-${{ hashFiles('vendor-bin/php-cs-fixer/composer.json') }}
restore-keys: ${{ runner.os }}-php-cs-fixer-
from composer-bin-plugin.
why is the nested composer.json necessary if you capture the lock one?
from composer-bin-plugin.
because I dont have a composer.lock committed within vendor-bin/
from composer-bin-plugin.
oh then yes, you need at least the json then :)
from composer-bin-plugin.
If you think that helps I'll welcome a PR to the doc to clarify that point :)
from composer-bin-plugin.
the main point is, that we need a lot more caching then just caching the regular composer vendor/.
you also need to cache the vendor-bin/$my-tool/vendor
from composer-bin-plugin.
It depends by what you want to cache. Traditionally, at least that is what I was doing in Travis and GitLab CI, I cache the Composer downloaded artefacts, not the vendor itself. In this sense it doesn't matter which vendor (be it a bin one or not) it is. The hash keys also matters less: I don't need to invalidate that cache (although I still can), Composer handles that for me.
If you cache the vendor directories then it's another story entirely. But IMO it's making things more complicated than necessary
from composer-bin-plugin.
let me be more precise:
composer bin php-cs-fixer install --no-progress
within a github actions triggers
- Installing symfony/polyfill-php70 (v1.15.0): Downloading (100%)
- Installing symfony/options-resolver (v3.4.38): Downloading (100%)
- Installing symfony/finder (v3.4.38): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.15.0): Downloading (100%)
- Installing symfony/filesystem (v3.4.38): Downloading (100%)
- Installing symfony/event-dispatcher (v3.4.38): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.15.0): Downloading (100%)
- Installing psr/log (1.1.3): Downloading (100%)
- Installing symfony/debug (v3.4.38): Downloading (100%)
- Installing symfony/console (v3.4.38): Downloading (100%)
- Installing php-cs-fixer/diff (v1.3.0): Downloading (100%)
- Installing doctrine/lexer (1.0.2): Downloading (100%)
- Installing doctrine/annotations (v1.4.0): Downloading (100%)
- Installing composer/xdebug-handler (1.4.1): Downloading (100%)
- Installing composer/semver (1.5.1): Downloading (100%)
- Installing friendsofphp/php-cs-fixer (v2.16.1): Downloading (100%)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/event-dispatcher suggests installing symfony/http-kernel
symfony/console suggests installing symfony/lock
friendsofphp/php-cs-fixer suggests installing php-cs-fixer/phpunit-constraint-isidenticalstring (For IsIdenticalString constraint.)
friendsofphp/php-cs-fixer suggests installing php-cs-fixer/phpunit-constraint-xmlmatchesxsd (For XmlMatchesXsd constraint.)
Writing lock file
when only using the regular composer caching like described in https://github.com/shivammathur/setup-php#cache-composer-dependencies
from composer-bin-plugin.
Can you double check the value of composer config cache-files-dir
? Because locally it points to $HOME/.composer/cache/files
and it's the same on Travis. If it points to a directory local to the project though, it might be that the bin one is using a different directory as well
from composer-bin-plugin.
I dont thinks thats relevant, because the example from shivammathur/setup-php uses a variable for that path:
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
however, the value is /home/runner/.composer/cache/files
in a github action
from composer-bin-plugin.
just to be sure we are on the same page.
regular project dependencies get installed into
/home/runner/.composer/cache/files
when using composer-bin-plugin
with a tool called php-cs-fixer
, the vendors of it will be installed into
/home/runner/work/my-github-org/my-project/vendor-bin/php-cs-fixer/vendor
from composer-bin-plugin.
@staabm the vendors should be installed in /home/runner/work/my-github-org/my-project/vendor-bin/php-cs-fixer/vendor
but stored in /home/runner/.composer/cache/files
, so unless something has been updated in-between or that the resolved version is different, the files to download should already be there.
Also just in case: I remember on Travis it needed to land on the master branch first before seeing the effects in the PR. Might be the same here
from composer-bin-plugin.
Related Issues (20)
- Call to undefined method when updating to 1.7.0 HOT 2
- Plugin fails to work with Composer < 2.3
- Call to undefined method during (and only during) the update from 1.5.0 to 1.7.0 HOT 2
- Plugin (still) fails to work with Composer < 2.3 HOT 1
- Compatibility with `Composer\InstalledVersions` API HOT 4
- Can outdated command be forwarded as well? HOT 5
- Inherit from github-oauth main composer.json HOT 2
- Create autoloader that include all package namespaces HOT 2
- Reuse existing packages via symlink HOT 2
- Detect installation via this plugin HOT 10
- Warning appears if multiple namespaces contain the same custom Composer script name HOT 2
- `composer update --lock` invokes `composer update` HOT 2
- Composer plugin support in namespaces? HOT 6
- Composer cache dir seems not be respected HOT 3
- No-Dev installation fails when defined as dev dependency HOT 2
- Dev-Dependencies installed when using --no-dev option HOT 1
- Doesn't work with ergebnis/composer-normalize HOT 6
- Drop support for PHP 5.x HOT 1
- Forward command not executed on first install
- Error with composer when using this plugin and it's allowed in `composer.json` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composer-bin-plugin.