From dfd84a7d15dedbb7ceebe61d0ba4560dfbeed914 Mon Sep 17 00:00:00 2001 From: Wil Wilsman Date: Fri, 11 Sep 2020 18:05:01 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Use=20alternate=20CI=20caching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, stale local packages might be kept around due to caching symlinks within the node_modules directories. By caching yarns cache, we can avoid caching our own linked packages --- .github/workflows/lint.yml | 11 ++++++----- .github/workflows/test.yml | 22 ++++++++++++---------- .github/workflows/typecheck.yml | 11 ++++++----- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1752210d0..b32862d22 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,12 +9,13 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 12 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 with: - path: | - node_modules - packages/*/node_modules - key: ${{ runner.os }}/node-12/${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}/node-12/ + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: v1/${{ runner.os }}/node-12/${{ hashFiles('**/yarn.lock') }} + restore-keys: v1/${{ runner.os }}/node-12/ - run: yarn - run: yarn lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb4195ef9..bef463f83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,13 +9,14 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 10 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 with: - path: | - node_modules - packages/*/node_modules - key: ${{ runner.os }}/node-10/${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}/node-10/ + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: v1/${{ runner.os }}/node-10/${{ hashFiles('**/yarn.lock') }} + restore-keys: v1/${{ runner.os }}/node-10/ - run: yarn - run: yarn build - uses: actions/upload-artifact@v2 @@ -48,13 +49,14 @@ jobs: - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 with: - path: | - node_modules - packages/*/node_modules - key: ${{ runner.os }}/node-${{ matrix.node }}/${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}/node-${{ matrix.node }}/ + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: v1/${{ runner.os }}/node-${{ matrix.node }}/${{ hashFiles('**/yarn.lock') }} + restore-keys: v1/${{ runner.os }}/node-${{ matrix.node }}/ - uses: actions/download-artifact@v2 with: name: dist diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index a3475f66f..164847498 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -9,12 +9,13 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 12 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 with: - path: | - node_modules - packages/*/node_modules - key: ${{ runner.os }}/node-12/${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}/node-12/ + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: v1/${{ runner.os }}/node-12/${{ hashFiles('**/yarn.lock') }} + restore-keys: v1/${{ runner.os }}/node-12/ - run: yarn - run: yarn test:types