release-hive-fe/.drone.yml

62 lines
1.8 KiB
YAML
Raw Normal View History

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:25:59 +01:00
image: openjdk:11-jre-slim
2025-03-09 01:14:22 +01:00
commands:
2025-03-09 01:29:59 +01:00
# Update package lists and install dependencies for Node.js
- apt-get update && apt-get install -y curl gnupg wget unzip
# Install Node.js (e.g., version 18) using Nodesource setup script
- curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
- apt-get install -y nodejs
# Verify Node.js is installed
- node -v
- npm -v
2025-03-09 01:25:59 +01:00
# Download the SonarScanner CLI zip (adjust the version as needed)
- wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.0.2.4839-linux-aarch64.zip -O sonar-scanner.zip
# Unzip it to /opt
- unzip sonar-scanner.zip -d /opt/
2025-03-09 01:29:59 +01:00
- rm sonar-scanner.zip
2025-03-09 01:25:59 +01:00
# Add sonar-scanner to the PATH (the folder name may vary with version)
- export PATH=/opt/sonar-scanner-7.0.2.4839-linux-aarch64/bin:$PATH
# Run the scanner
2025-03-09 01:29:59 +01:00
- sonar-scanner -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.token=$SONAR_LOGIN_KEY
2025-03-09 01:14:22 +01:00
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