Use safer node_modules cache (#803)

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2020-11-29 10:07:44 +01:00 committed by GitHub
parent e8ccd44ff7
commit 590218c7c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 14 deletions

View file

@ -20,17 +20,23 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 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 - name: Cache node_modules
uses: actions/cache@v2.1.3 uses: actions/cache@v2
id: yarn-cache
with: with:
path: node_modules path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: node_modules key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up NodeJS - name: Set up NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
- name: Install dependencies - name: Install dependencies
run: yarn install run: yarn install --frozen-lockfile --prefer-offline
- name: Test Project - name: Test Project
run: yarn test run: yarn test
- name: Build project - name: Build project

View file

@ -16,20 +16,32 @@ jobs:
name: build frontend name: build frontend
steps: steps:
- uses: actions/checkout@v2 - 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 - name: Cache build
uses: actions/cache@v2.1.3 uses: actions/cache@v2.1.3
with: with:
path: build path: build
key: build key: build
- name: Cache node_modules - name: Cache node_modules
uses: actions/cache@v2.1.3 uses: actions/cache@v2
id: yarn-cache
with: with:
path: node_modules path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: node_modules key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- uses: actions/setup-node@v1 restore-keys: |
${{ runner.os }}-yarn-
- name: Set up NodeJS
uses: actions/setup-node@v1
with: with:
node-version: '14' node-version: 14
- run: yarn install
- run: yarn install --frozen-lockfile --prefer-offline
- run: yarn build - run: yarn build
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:

View file

@ -17,16 +17,25 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 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 - name: Cache node_modules
uses: actions/cache@v2.1.3 uses: actions/cache@v2
id: yarn-cache
with: with:
path: node_modules path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: node_modules key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up NodeJS - name: Set up NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 14 node-version: 14
- name: Install dependencies - name: Install dependencies
run: yarn install run: yarn install --frozen-lockfile --prefer-offline
- name: Lint code - name: Lint code
run: yarn lint run: yarn lint