Skip to content

Update node.js.yml

Update node.js.yml #2

Workflow file for this run

name: Node.js CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v3
# Backend
- name: Build and Test Backend
if: ${{ contains(github.event_name, 'push') && contains(github.event.head_commit.modified, 'backend/') }}
runs-on: ubuntu-latest
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: cd backend
- run: npm ci
- run: npm run build --if-present
- run: npm test
# Frontend
- name: Build and Test Frontend
if: ${{ contains(github.event_name, 'push') && contains(github.event.head_commit.modified, 'frontend/') }}
runs-on: ubuntu-latest
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: cd frontend
- run: npm ci
- run: npm run build --if-present
- run: npm test