From 590218c7c4d5eb344ec064e9153a2368bae46070 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 29 Nov 2020 10:07:44 +0100 Subject: [PATCH] Use safer node_modules cache (#803) Signed-off-by: Tilman Vatteroth --- .github/workflows/build.yml | 14 ++++++++++---- .github/workflows/e2e.yml | 24 ++++++++++++++++++------ .github/workflows/lint.yml | 17 +++++++++++++---- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba1f6f875..7aed4a4d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,17 +20,23 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - name: Cache node_modules - uses: actions/cache@v2.1.3 + uses: actions/cache@v2 + id: yarn-cache with: - path: node_modules - key: node_modules + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Set up NodeJS uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile --prefer-offline - name: Test Project run: yarn test - name: Build project diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b61ea3cbc..44192a7fc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -16,20 +16,32 @@ jobs: name: build frontend steps: - uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Cache build uses: actions/cache@v2.1.3 with: path: build key: build + - name: Cache node_modules - uses: actions/cache@v2.1.3 + uses: actions/cache@v2 + id: yarn-cache with: - path: node_modules - key: node_modules - - uses: actions/setup-node@v1 + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Set up NodeJS + uses: actions/setup-node@v1 with: - node-version: '14' - - run: yarn install + node-version: 14 + + - run: yarn install --frozen-lockfile --prefer-offline - run: yarn build - uses: actions/upload-artifact@master with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 66d120055..5793047b7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,16 +17,25 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Cache node_modules - uses: actions/cache@v2.1.3 + uses: actions/cache@v2 + id: yarn-cache with: - path: node_modules - key: node_modules + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Set up NodeJS uses: actions/setup-node@v1 with: node-version: 14 - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile --prefer-offline - name: Lint code run: yarn lint