From 731c1a98ee65146ef48d3c5d8c9efe22fe38643f Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Sun, 25 Oct 2020 14:04:10 -0500 Subject: [PATCH] Update caching and make it more logical --- .github/workflows/js.yml | 21 ++++++++++----------- .github/workflows/notice_js.yml | 6 ++++-- .github/workflows/notice_ruby.yml | 13 ++++++++----- .github/workflows/ruby.yml | 6 +++--- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 49dd354c..98035f85 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -24,12 +24,12 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ matrix.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn- - run: yarn install --frozen-lockfile if: steps.node-cache.outputs.cache-hit != 'true' - name: run eslint @@ -50,14 +50,13 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ matrix.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn- - run: yarn install --frozen-lockfile - if: steps.node-cache.outputs.cache-hit != 'true' - name: run jest run: yarn jest webpack: @@ -83,17 +82,17 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ matrix.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn- - run: yarn install --frozen-lockfile - uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 with: ruby-version: ${{ matrix.ruby }} - - uses: actions/cache@v1 + - uses: actions/cache@v2 name: Use Gem cache with: path: vendor/bundle diff --git a/.github/workflows/notice_js.yml b/.github/workflows/notice_js.yml index f1439aaa..d799a7d7 100644 --- a/.github/workflows/notice_js.yml +++ b/.github/workflows/notice_js.yml @@ -2,6 +2,7 @@ name: NOTICE-js verification env: node: 14.6.0 + os: ubuntu-latest on: push: paths: @@ -31,9 +32,10 @@ jobs: id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ env.node }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ env.os }}-yarn-${{ env.node }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-yarn-${{ env.node }}- + ${{ env.os }}-yarn-${{ env.node }}- + ${{ env.os }}-yarn- - run: yarn install --frozen-lockfile if: steps.node-cache.outputs.cache-hit != 'true' - name: Verify NOTICE-js diff --git a/.github/workflows/notice_ruby.yml b/.github/workflows/notice_ruby.yml index ceea679f..1219e0c5 100644 --- a/.github/workflows/notice_ruby.yml +++ b/.github/workflows/notice_ruby.yml @@ -11,21 +11,24 @@ on: - Gemfile - Gemfile.lock - NOTICE-ruby +env: + os: ubuntu-latest + ruby: 2.6.6 jobs: notice_ruby: - runs-on: ubuntu-latest + runs-on: ${{ env.os }} steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 with: - ruby-version: 2.6.6 - - uses: actions/cache@v1 + ruby-version: ${{ env.ruby }} + - uses: actions/cache@v2 name: Use Gem cache with: path: vendor/bundle - key: bundle-use-ruby-ubuntu-latest-2.6.6-${{ hashFiles('**/Gemfile.lock') }} + key: bundle-use-ruby-${{ env.os }}-${{ env.ruby }}-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | - bundle-use-ruby-ubuntu-latest-2.6.6- + bundle-use-ruby-${{ env.os }}-${{ env.ruby }}- - run: | bundle config deployment true bundle config path vendor/bundle diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 59f80958..f3a3d311 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -47,15 +47,15 @@ jobs: id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ matrix.os }}-yarn-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-yarn-${{ matrix.node }}- + ${{ matrix.os }}-yarn-${{ matrix.node }}- - run: yarn install --frozen-lockfile if: steps.node-cache.outputs.cache-hit != 'true' - uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 with: ruby-version: ${{ matrix.ruby }} - - uses: actions/cache@v1 + - uses: actions/cache@v2 name: Use Gem cache with: path: vendor/bundle