From ab9d3b034bc891f78c91bf07abc4f0e58b3e032c Mon Sep 17 00:00:00 2001 From: Bart <45095973+barthuijgen@users.noreply.github.com> Date: Thu, 11 Mar 2021 10:49:50 +0100 Subject: [PATCH] Add cache to yarn install in actions --- .github/workflows/validate.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d4002e0..e154415 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,13 +1,6 @@ -name: Nx validate CI +name: Validate -on: - push: - branches: - - master - - dev - pull_request: - branches: - - "*" +on: pull_request jobs: validate: @@ -16,8 +9,18 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: "14" - - run: yarn + node-version: "14.x" + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - run: yarn --prefer-offline - run: yarn db-gen - run: yarn nx lint - run: yarn nx test