- Fix CI: remove redundant push trigger, keep only pull_request on main - Fix CI: remove continue-on-error on lint and test steps - Fix accessibility: wrap h1 routerLink in <a> element in header - Fix reactivity: use paramMap observable instead of route.snapshot - Extract CO2 thresholds to co2-levels.config.ts - Fix environment.template.ts comment to English - Fix wsUrl in environment.ts to include /ws path - Fix production URLs: hes-so.ch -> ui.e.kb28.ch - Fix README: align Models convention with kebab-case .model.ts suffix - Remove redundant .gitkeep files from directories with README.md
93 lines
2.4 KiB
YAML
93 lines
2.4 KiB
YAML
name: Angular CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'ui/**'
|
|
- '.github/workflows/angular-ci.yml'
|
|
|
|
jobs:
|
|
build-and-test:
|
|
name: Build and Test Angular App
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./ui
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [20.x]
|
|
|
|
steps:
|
|
# Checkout code
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
# Setup Node.js
|
|
- name: Setup Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
cache-dependency-path: './ui/package-lock.json'
|
|
|
|
# Install dependencies
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
# Check TypeScript compilation
|
|
- name: TypeScript compilation check
|
|
run: npx tsc --noEmit
|
|
|
|
# Run linting
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
# Check code formatting
|
|
- name: Check Prettier formatting
|
|
run: npm run format:check
|
|
|
|
# Build development
|
|
- name: Build (Development)
|
|
run: npm run build -- --configuration=development
|
|
|
|
# Build production
|
|
- name: Build (Production)
|
|
run: npm run build -- --configuration=production
|
|
|
|
# Run unit tests
|
|
- name: Run unit tests
|
|
run: npm run test -- --watch=false --browsers=ChromeHeadless --code-coverage
|
|
|
|
# Upload coverage (when tests exist)
|
|
- name: Upload coverage reports
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: ui/coverage/
|
|
retention-days: 7
|
|
continue-on-error: true
|
|
|
|
# Upload build artifacts
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: angular-build
|
|
path: ui/dist/
|
|
retention-days: 7
|
|
|
|
# Summary
|
|
- name: Build summary
|
|
if: success()
|
|
run: |
|
|
echo "Build successful!" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "### Build Details" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Node version: ${{ matrix.node-version }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Angular version: 18.x" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Build time: $(date)" >> $GITHUB_STEP_SUMMARY
|