Project

ci-cache

0.0
No commit activity in last 3 years
No release in over 3 years
cache files in an ephemeral continuous integration environment
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.99

Runtime

~> 1.64
 Project Readme

ci-cache Gem Version Build Status Code Climate Dependency Status

Cache files and folders between continues integration builds for faster build execution. Usable with Travis CI and others.

Usage

Configuration

The ci-cache uses environment variables to receive the AWS config.

CI_CACHE_S3_BUCKET="cache-bucket"
CI_CACHE_S3_PREFIX="prefix-for-files/"
CI_CACHE_S3_KEY="aws-key"
CI_CACHE_S3_SECRET="aws-secret"

Download cached file / folder

ci-cache get --name cache-key --output-path .

Upload cached file / folder

ci-cache set --name cache-key --content cache-folder --hash-file version.lock

The cached is only re-uploaded, if the hash-file has changed.

Examples (Travis CI)

You should encrypt your AWS credentials

travis encrypt CI_CACHE_S3_KEY=AWS_KEY CI_CACHE_S3_SECRET=AWS_SECRET --add

Bundler

---
bundler_args: --without development --path=~/.bundle
language: ruby
rvm:
- 2.0.0
env:
  global:
  - CI_CACHE_S3_BUCKET="cache-bucket"
  - CI_CACHE_S3_PREFIX="$TRAVIS_REPO_SLUG/"
  - CI_CACHE_S3_KEY="cache-aws-key"
  - CI_CACHE_S3_SECRET="cache-aws-secret"
before_install:
- travis_retry gem install ci-cache --no-ri --no-rdoc
- ci-cache get --name bundler-cache --output-path ~
after_script:
- bundle clean
- ci-cache set --name bundler-cache --content ~/.bundle --hash-file Gemfile.lock

Node.js - NPM

language: node_js
node_js:
- '0.10'
env:
  global:
  - CI_CACHE_S3_BUCKET="cache-bucket"
  - CI_CACHE_S3_PREFIX="$TRAVIS_REPO_SLUG/"
  - CI_CACHE_S3_KEY="cache-aws-key"
  - CI_CACHE_S3_SECRET="cache-aws-secret"
before_install:
- travis_retry gem install ci-cache --no-ri --no-rdoc
- ci-cache get --name node_modules --output-path .
- npm prune
after_script:
- ci-cache set --name node_modules --content node_modules --hash-file package.json

Bower (path app/bower_components)

language: node_js
node_js:
- '0.10'
env:
  global:
  - CI_CACHE_S3_BUCKET="cache-bucket"
  - CI_CACHE_S3_PREFIX="$TRAVIS_REPO_SLUG/"
  - CI_CACHE_S3_KEY="cache-aws-key"
  - CI_CACHE_S3_SECRET="cache-aws-secret"
before_install:
- travis_retry gem install ci-cache --no-ri --no-rdoc
- ci-cache get --name bower_components --output-path app
- travis_retry npm install -g bower
- bower prune
- travis_retry bower install
after_script:
- ci-cache set --name bower_components --content app/bower_components --hash-file bower.json