Skip to content

Commit

Permalink
chore: change cache strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Mar 3, 2022
1 parent 953022c commit 855d0de
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 14 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ jobs:
with:
node-version: 17

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-17-16-yarn-
- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ jobs:
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-17-16-yarn-
- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
- name: Release Canary
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ jobs:
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-17-16-yarn-
- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
- name: Create Release Pull Request or Publish to npm
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 17
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-17-16-yarn-
- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
- name: Lint
Expand All @@ -42,11 +47,16 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 17
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-16-${{matrix.graphql_version}}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-${{matrix.graphql_version}}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-16-yarn-
- name: Use GraphQL v${{matrix.graphql_version}}
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
- name: Install Dependencies using Yarn
Expand All @@ -71,11 +81,16 @@ jobs:
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-yarn-
- name: Use GraphQL v${{matrix.graphql_version}}
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
- name: Install Dependencies using Yarn
Expand All @@ -99,11 +114,14 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 17
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/*.patch') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-17-16-yarn-${{ hashFiles('yarn.lock') }}
- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
- name: Build Packages
Expand Down

0 comments on commit 855d0de

Please sign in to comment.