From 55f9c8a147701f864602a16f0a6eb30054806b25 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Thu, 31 Oct 2019 16:03:40 +0900 Subject: [PATCH] Cache gems for GitHub Actions Follows up #37582 GitHub Actions cache requires `path:` parameter to configure which directory to be cached. It looks there is no easy way to retrieve path information using bundler command then workaround implemented to use `vendor/bundle`. Thanks to https://github.com/actions/cache/pull/4 --- .github/workflows/rubocop.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 14b9f03270..181a4b6c9a 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -15,7 +15,15 @@ jobs: - name: Install required package run: | sudo apt-get install libmysqlclient-dev libpq-dev libsqlite3-dev libncurses5-dev + - name: Cache gems + uses: actions/cache@preview + with: + path: vendor/bundle + key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gem- - name: Build and run RuboCop run: | + bundle config path vendor/bundle bundle install --jobs 4 --retry 3 bundle exec rubocop --parallel