From 97af0f8a86e9f45e131f44a767d3da4384dca290 Mon Sep 17 00:00:00 2001 From: Erez Rokah Date: Mon, 11 Nov 2019 11:19:47 +0200 Subject: [PATCH] ci: add yarn caching (#2866) --- .github/workflows/nodejs.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e613d81a..76c95075 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -24,12 +24,18 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + - uses: actions/cache@v1 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} + restore-keys: | + ${{ runner.os }}-yarn- - name: npm install, unit test and build run: | node --version npm --version yarn --version - yarn + yarn --frozen-lockfile yarn bootstrap yarn test:ci yarn build:demo @@ -57,6 +63,12 @@ jobs: uses: actions/setup-node@v1 with: node-version: 10.x + - uses: actions/cache@v1 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} + restore-keys: | + ${{ runner.os }}-yarn- - uses: actions/download-artifact@master with: name: dev-test-website-node-10.x @@ -66,13 +78,13 @@ jobs: node --version npm --version yarn --version - yarn + yarn --frozen-lockfile yarn test:e2e:run-ci env: CI: true CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} NODE_OPTIONS: --max-old-space-size=4096 - + # forked workflow (no acceess to build secrets) e2e-no-cypress-record: needs: build @@ -85,6 +97,12 @@ jobs: uses: actions/setup-node@v1 with: node-version: 10.x + - uses: actions/cache@v1 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} + restore-keys: | + ${{ runner.os }}-yarn- - uses: actions/download-artifact@master with: name: dev-test-website-node-10.x @@ -94,8 +112,8 @@ jobs: node --version npm --version yarn --version - yarn + yarn --frozen-lockfile yarn test:e2e:run env: CI: true - NODE_OPTIONS: --max-old-space-size=4096 \ No newline at end of file + NODE_OPTIONS: --max-old-space-size=4096