Skip to content

fix: branch workflow fix #5

fix: branch workflow fix

fix: branch workflow fix #5

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Continous Integration for All Components
on:
push:
branches-ignore:
- master
paths:
- 'roomchat-frontend/**'
- 'roomchat-backend/**'
- 'contracts/**'
pull_request:
types: [opened, reopened]
jobs:
build-and-test-backend:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [21.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ${{vars.BACKEND_DIR}}/package-lock.json
- name: Install dependencies and run tests
run: |
npm ci --prefix ${{vars.BACKEND_DIR}}
npm run build --if-present --prefix ${{vars.BACKEND_DIR}}
npm test --prefix ${{vars.BACKEND_DIR}}
build-and-test-frontend:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 21.x]
steps:
- uses: actions/checkout@v3
- name: Set up Node.js ${{ matrix.node-version }} for frontend
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: '${{vars.FRONTEND_DIR}}/package-lock.json'
- name: Install frontend dependencies
run: npm ci --prefix ${{vars.FRONTEND_DIR}}
- name: Build and test frontend (if present)
run: npm run build --if-present --prefix ${{vars.FRONTEND_DIR}}