Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build and Test (Vite React)

on:
push:
branches: [ GitWorkflow ]
pull_request:
branches: [ GitWorkflow ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./Esercizi/GithubWorkflow/GitWorkflow

steps:
# 1️⃣ Checkout repository
- name: Checkout code
uses: actions/checkout@v5

# Cache node modules
- name: Cache node modules
uses: actions/cache@v3
with:
path: ./Esercizi/GithubWorkflow/GitWorkflow/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('Esercizi/GithubWorkflow/GitWorkflow/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

# 2️⃣ Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'

# 3️⃣ Install dependencies
- name: Install dependencies
run: npm ci
working-directory: ./Esercizi/GithubWorkflow/GitWorkflow

# 4️⃣ Build project
- name: Build project
run: npm run build

# 5️⃣ Run tests (solo se presenti)
- name: Run tests
run: npm test --if-present

# 6️⃣ Upload build artifact (cartella dist)
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: vite-dist
path: ./Esercizi/GithubWorkflow/GitWorkflow/dist