Skip to content

Commit

Permalink
Merge pull request #9 from upfluence/mb/VEL-1857
Browse files Browse the repository at this point in the history
Enable sonarqube on ember-brand-manager
  • Loading branch information
Miexil authored May 16, 2024
2 parents 642d8f8 + 81fc6d9 commit 11ef5a3
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/libpeerconnection.log
/npm-debug.log*
/testem.log
.scannerwork/

# ember-try
/.node_modules.ember-try/
Expand Down
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.PHONY: start

.EXPORT_ALL_VARIABLES:

SHELL := /bin/bash
PORT := 0
ENV := development

all: clear echo start ## Starts the dev server

clear:
@clear

install: ## Runs 'pnpm' to install dependencies
@echo 'Installing dependencies'
pnpm install
@echo ""; echo "-------------------------------"; echo ""

echo:
@echo Starting ember-brand-manager

start:
ember s --port $(PORT) --environment ${ENV}

build:
ember build --environment ${ENV}

clean: ## Cleans ./node_modules && ./dist
@echo "Cleaning up ./node_modules & ./dist folders"
-rm -r ./node_modules
-rm -r ./dist
@echo ""; echo "-------------------------------"; echo ""

re: clean install echo start ## Reinstalls dependencies & starts the dev server

help: clear ## Displays the help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

h: help ## Displays the help message

version_patch: ## Creates & pushes a new patch tag
./scripts/new-version-tag patch

version_minor: ## Creates & pushes a new minor tag
./scripts/new-version-tag minor

version_major: ## Creates & pushes a new major tag
./scripts/new-version-tag major

sonar-report: ## Runs a bunch of commands that will finally lead to a new report in sonarqube
./scripts/generate_sonar_report
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module.exports = {
brand: process.env.BRAND || DEFAULT_BRAND,
brandPageTitle: process.env.BRAND_PAGE_TITLE || DEFAULT_PAGE_TITLE
}
},
babel: {
plugins: [...require('ember-cli-code-coverage').buildBabelPlugin()],
}
},

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"babel-eslint": "^10.1.0",
"ember-auto-import": "^2.2.4",
"ember-cli": "~4.0.0",
"ember-cli-code-coverage": "^3.0.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-disable-prototype-extensions": "^1.1.3",
Expand Down
153 changes: 153 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions scripts/generate_sonar_report
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
## This script automates the flow to generate a new activity report in sonarqube

echo "[Generating a sonar report.]"
echo ""
echo ""

## Check that sonarqube property file exists
echo "[Step1] Check for sonar-project.properties file existence:"
if test -f "./sonar-project.properties"; then
echo "File exists."
else
echo "File is missing. Check your configuration."
exit 1
fi

## Run ember test & generate code coverage with [ember-cli-code-coverage]
echo ""
echo ""
echo "[Step2] Run ember test - dot reporter to generate lcovinfo file"
COVERAGE=true ember test

## Check that coverage folder has been generated
echo ""
echo ""
echo "[Step3] Check that coverage folder has been generated"
if [ -d "./coverage" ]; then
echo "./coverage directory successfully created."
else
echo "./coverage directory not found. Check your configuration."
exit 1
fi

## Run sonar-scanner with the proper project version
echo ""
echo ""
echo "[Step4] Run sonar-scanner"
sonar-scanner -D sonar.projectVersion=$(git describe --tags --abbrev=0) -Dsonar.login=$SONARCLOUD_FRONTEND_TOKEN

echo "[Success]"
Loading

0 comments on commit 11ef5a3

Please sign in to comment.