🐛(CI) improve caching

When we restored the frontend cache, we were restoring
old code as well, we don't want that, we want to only
restore the node_modules.
This commit fixes that.
We improve the build-front caching as well, to cache
only the desk build app.
This commit is contained in:
Anthony LC
2024-04-02 16:04:49 +02:00
committed by Anthony LC
parent e8180bc49b
commit 1223732fa9

View File

@@ -71,22 +71,22 @@ jobs:
node-version: '18.x'
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
uses: actions/cache@v4
id: front-node_modules
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
path: 'src/frontend/**/node_modules'
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Install dependencies
if: steps.cache-install.outputs.cache-hit != 'true'
if: steps.front-node_modules.outputs.cache-hit != 'true'
run: cd src/frontend/ && yarn install --frozen-lockfile
- name: Cache install frontend
if: steps.cache-install.outputs.cache-hit != 'true'
uses: actions/cache@v3
if: steps.front-node_modules.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
path: 'src/frontend/**/node_modules'
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
build-front:
runs-on: ubuntu-latest
@@ -96,21 +96,21 @@ jobs:
uses: actions/checkout@v4
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
uses: actions/cache@v4
id: front-node_modules
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
path: 'src/frontend/**/node_modules'
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Build CI App
run: cd src/frontend/ && yarn ci:build
- name: Cache build frontend
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: src/frontend/
path: src/frontend/apps/desk/out/
key: build-front-${{ github.run_id }}
test-front:
runs-on: ubuntu-latest
needs: install-front
@@ -119,11 +119,11 @@ jobs:
uses: actions/checkout@v4
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
uses: actions/cache@v4
id: front-node_modules
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
path: 'src/frontend/**/node_modules'
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Test App
run: cd src/frontend/ && yarn app:test
@@ -136,11 +136,11 @@ jobs:
uses: actions/checkout@v4
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
uses: actions/cache@v4
id: front-node_modules
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
path: 'src/frontend/**/node_modules'
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Check linting
run: cd src/frontend/ && yarn lint
@@ -164,11 +164,18 @@ jobs:
name: mails-templates
path: src/backend/core/templates/mail
- name: Restore the frontend cache
uses: actions/cache@v4
id: front-node_modules
with:
path: 'src/frontend/**/node_modules'
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Restore the build cache
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-build
with:
path: src/frontend/
path: src/frontend/apps/desk/out/
key: build-front-${{ github.run_id }}
- name: Build and Start Docker Servers