Skip to content

Commit

Permalink
modified node modules with cache
Browse files Browse the repository at this point in the history
  • Loading branch information
BkPankaj committed Jun 2, 2024
1 parent 3bf4bad commit d8bed49
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/CI_Workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,19 @@ jobs:
node-version: '18'

- name: Install frontend dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: frontend
run: npm install --legacy-peer-deps
run: npm ci --legacy-peer-deps

- name: Cache Node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -44,12 +55,6 @@ jobs:
- name: Generate static files
run: python backend/manage.py collectstatic

- name: Save node_modules
uses: actions/upload-artifact@v4
with:
name: node_modules
path: frontend/node_modules

- name: Save venv
uses: actions/upload-artifact@v4
with:
Expand All @@ -63,15 +68,26 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore node_modules
uses: actions/download-artifact@v4
- name: Restore Node modules cache
id: restore-node-modules
uses: actions/cache@v4
with:
name: node_modules
path: frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/frontend/package-lock.json') }}

- name: Install frontend dependencies
if: steps.restore-node-modules.outputs.cache-hit != 'true'
working-directory: frontend
run: npm ci --legacy-peer-deps

- name: Permissions for node_modules
run: chmod -R +x frontend/node_modules/.bin

- name: Verify node_modules restoration
run: |
ls -la frontend/node_modules
ls -la frontend/node_modules/.bin
- name: Run frontend test
run: npm test -- --watchAll=false
working-directory: frontend

0 comments on commit d8bed49

Please sign in to comment.