From 1223732fa9568c2a2afda4c29b139b10f485f86c Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Tue, 2 Apr 2024 16:04:49 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(CI)=20improve=20caching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflows/people.yml | 59 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/.github/workflows/people.yml b/.github/workflows/people.yml index 47bd8d7..04eb48f 100644 --- a/.github/workflows/people.yml +++ b/.github/workflows/people.yml @@ -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