Skip to content

Merge pull request #7 from tensor5/compose-for-prod #11

Merge pull request #7 from tensor5/compose-for-prod

Merge pull request #7 from tensor5/compose-for-prod #11

name: Tests Frontend CI
on:
push:
branches:
- master
- 'feature/**'
pull_request:
branches:
- master
jobs:
frontend-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
# 1️⃣ Checkout repository
- name: Checkout repository
uses: actions/checkout@v3
# 2️⃣ Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# 3️⃣ Cache delle dipendenze npm
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('unicontract-frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# 4️⃣ Install dependencies
- name: Install dependencies
run: npm ci
working-directory: unicontract-frontend
# 5️⃣ Build Angular (opzionale, ma consigliato)
- name: Build Angular
run: npm run build --if-present
working-directory: unicontract-frontend
# 6️⃣ Run tests in headless mode
- name: Run frontend tests
run: npx ng test --watch=false --browsers=ChromeHeadlessCI
working-directory: unicontract-frontend
env:
CHROME_BIN: /usr/bin/google-chrome