clarify .travis.yml setting that'll work with packrat AND caching
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 409
- Forks
- 89
- PR merge metrics
- No merged PRs in 30d
Description
There appears to be some confusion (at least on my part) how to set up travis correctly for packrat so that:
packrat/lib*is cached (because otherwise, build times go crazy for every minor correction)- the travis cache is properly updated whenever
packrat/packrat.lockandpackrat/srcchange (otherwise, and this is the situation so far, users have to manually clear the Travis cache whenever they add/update/remove packages from packrat).
Not a lot of people seem to be using this, though it seems like a fairly important piece to the reproducibility puzzle.
With generous help from @jimhester and @kevinushey on a related travis issue I've now figured out what I think ought to work in all use cases and offer both caching, and cache invalidation.
Important caveat: this requires packrat/src to be committed (as it should be) and packrat/lib* to be .gitignoreed (as it should be).
language: r
sudo: false
install:
- R -e "0" --args --bootstrap-packrat
- R -e "packrat::restore(restart = FALSE)"
warnings_are_errors: false
cache:
packages: true
directories:
- $TRAVIS_BUILD_DIR/_bookdown_files
- $TRAVIS_BUILD_DIR/packrat/lib
script:
- Rscript test-script.R
notifications:
email: false
You can see this .travis.yml in action on this reprex repo and these builds.
If this makes sense to you people, I'd suggest / do the following:
- [ ] I'll include this via PR into the Travis CI docs
- [ ] I'll add this to the StackExchange question as an answer
- [ ] perhaps you could include this in the
packratdocs and/ordevtools::use_travis()/devtools::use_packrat()?
Hope this will be useful to other people.
background on the status quo:
The settings floating around on Stack Exchange etc. so far don't accomplish this:
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
language: R
sudo: false
cache:
directories: $TRAVIS_BUILD_DIR/packrat/
packages: true
install:
- R -e "0" --args --bootstrap-packrat
warnings_are_errors: false
This caches packrat alright, but Travis won't know when packrat.lock and packrat/src have actually changed, so it'll fail with something like package not known whenever a new one is added etc.
Users have to manually delete the travis cache under these settings, which is cumbersome, and easy to forget.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed .travis.yml configuration and compare it with the existing packrat documentation and any devtools::use_travis() or devtools::use_packrat() guidance. Confirm how packrat/lib, packrat/packrat.lock, and packrat/src are handled, then document a supported setup whose cache updates when dependencies change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- ci-cd, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100