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