2025-03-09 01:14:22 +01:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: build
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: arm64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
- main
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# Install project dependencies
|
|
|
|
- name: install
|
|
|
|
image: node:20-alpine
|
|
|
|
commands:
|
|
|
|
- npm ci
|
|
|
|
|
|
|
|
# Build the Angular project
|
|
|
|
- name: build
|
2025-03-09 01:16:24 +01:00
|
|
|
image: node:20-alpine
|
2025-03-09 01:14:22 +01:00
|
|
|
commands:
|
|
|
|
- npm run build --if-present
|
|
|
|
|
|
|
|
# Run unit tests (e.g. using Karma, Jest or your configured test runner)
|
2025-03-09 01:16:24 +01:00
|
|
|
# - name: test
|
|
|
|
# image: node:20-alpine
|
|
|
|
# commands:
|
|
|
|
# - npm test
|
2025-03-09 01:14:22 +01:00
|
|
|
|
|
|
|
# Run SonarQube code analysis
|
|
|
|
- name: code-analysis
|
2025-03-09 01:16:24 +01:00
|
|
|
image: node:20-alpine
|
2025-03-09 01:14:22 +01:00
|
|
|
commands:
|
|
|
|
- npm install -g sonar-scanner
|
2025-03-09 01:18:35 +01:00
|
|
|
- chmod +x /usr/local/lib/node_modules/sonar-scanner/bin/sonar-scanner
|
2025-03-09 01:14:22 +01:00
|
|
|
- sonar-scanner -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.login=$SONAR_LOGIN_KEY
|
|
|
|
environment:
|
|
|
|
SONAR_PROJECT_KEY:
|
|
|
|
from_secret: sonar_project_key
|
|
|
|
SONAR_INSTANCE_URL:
|
|
|
|
from_secret: sonar_instance_url
|
|
|
|
SONAR_LOGIN_KEY:
|
|
|
|
from_secret: sonar_login_key
|