Revert "Revert "Dts 40123 retain kpi filter across dashboards" #1627" #3584
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
# push: | |
# branches: [ master ] | |
pull_request: | |
types: | |
- labeled | |
- unlabeled | |
- synchronize | |
- opened | |
- edited | |
- ready_for_review | |
- reopened | |
- unlocked | |
branches: | |
- master | |
- develop | |
- qa-master | |
pull_request_review: | |
types: [edited, dismissed] | |
branches: | |
- master | |
- develop | |
- qa-master | |
env: | |
GITHUB_HEAD_NAME: $GITHUB_HEAD_REF | |
sonartoken: ${{secrets.SONARQUBE_TOKEN}} | |
sonarurl: ${{secrets.SONARURL}} | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
GitHub_CI: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Sleep for 5 min | |
if: github.event_name == 'push' | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '5s' | |
- uses: actions/checkout@v2 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
UI: | |
- 'UI/src/**' | |
- name: Building UI | |
# run only if some file in 'src' folder was changed | |
if: steps.changes.outputs.UI == 'true' | |
id: BuildUI | |
run: | | |
hostname | |
java -version | |
cd UI | |
sudo chmod -R 777 /usr/local/lib/node_modules | |
sudo npm cache clean --force | |
sudo npm install | |
sudo npm install -g @angular/cli@14.2.6 | |
#npm install --save-dev @angular-devkit/build-angular | |
sudo npm run build | |
sudo mkdir -p build | |
sudo cp -r dist/dashboard/* build/ | |
sudo chmod -R 775 build | |
cd build | |
sudo tar -czvf ui2.tar * | |
sudo mv ui2.tar ../files | |
sudo rm -rf build | |
- name: Unit Testing UI | |
if: steps.changes.outputs.UI == 'true' | |
id: TestUI | |
run: | | |
cd UI | |
sudo npm install --save-dev @angular-devkit/build-angular@14.2.10 | |
sudo ng test --code-coverage | |
#sudo sed -i 's|SF:UI/|SF:|g' coverage/lcov.info | |
- name: Scanning UI with Sonar Qube | |
if: steps.changes.outputs.UI == 'true' | |
id: SonarUI | |
run: | | |
cd UI | |
echo 'sonar.branch.name='${{env.GITHUB_HEAD_NAME}}''>> sonar-project.properties | |
echo 'sonar.host.url=${{secrets.SONARQUBE_HOST}}'>> sonar-project.properties | |
echo 'sonar.login=${{secrets.SONARQUBE_TOKEN}}'>> sonar-project.properties | |
sudo chmod -R 777 /home/runner/ | |
npm install -D sonarqube-scanner | |
npm run sonar | |
- name: Checking UI sonar QG | |
if: steps.changes.outputs.UI == 'true' | |
id: SonarUIqg | |
run: | | |
chmod +x SonarDelay.sh | |
./SonarDelay.sh ./UI/.scannerwork/report-task.txt | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- uses: dorny/paths-filter@v2 | |
id: customapi | |
with: | |
filters: | | |
customapi: | |
- 'customapi/src/**' | |
- uses: dorny/paths-filter@v2 | |
id: processors | |
with: | |
filters: | | |
processors: | |
- 'processors/**' | |
- name: Building and Testing CustomApi processor | |
if: steps.customapi.outputs.customapi == 'true' | |
id: unittestcustomapi | |
run: | | |
mvn clean install -Pcustomapi | |
- name: Running sonarqube CustomApi processor | |
if: steps.customapi.outputs.customapi == 'true' | |
id: sonartestcustomapi | |
run: | | |
mvn sonar:sonar -Dsonar.projectKey=ENGINEERING.KPIDASHBOARD.CUSTOMAPI -Dsonar.projectName=ENGINEERING.KPIDASHBOARD.CUSTOMAPI -Dsonar.branch.name=$GITHUB_HEAD_REF -Dsonar.host.url=${{secrets.SONARQUBE_HOST}} -Dsonar.login=${{secrets.SONARQUBE_TOKEN}} -f customapi/pom.xml -X | |
- name: Running sonarqube quality gates CustomApi processor | |
if: steps.customapi.outputs.customapi == 'true' | |
id: qgtestcustomapi | |
run: | | |
chmod +x SonarDelay.sh | |
./SonarDelay.sh ./customapi/target/sonar/report-task.txt ${{secrets.SONARQUBE_TOKEN}} ${{secrets.SONARQUBE_HOST}} | |
- name: Building and Testing jira processor | |
if: steps.processors.outputs.processors == 'true' | |
id: testjira | |
run: | | |
mvn clean install -Pjira-processor | |
- name: Building and Testing Azure processor | |
id: testazure | |
if: steps.processors.outputs.processors == 'true' | |
run: | | |
mvn clean install -Pazure-board-processor | |
- name: Building and Testing Devops processor | |
id: testdevops-processor | |
if: steps.processors.outputs.processors == 'true' | |
run: | | |
mvn clean install -Pdevops-processor | |
- name: Building and Testing azure-pipeline-repo | |
id: testazure-pipeline-repo | |
if: steps.processors.outputs.processors == 'true' | |
run: | | |
mvn clean install -Pazure-pipeline-repo | |
- name: Checking code Quality using SonarQube for processor | |
id: Sonarprocessor | |
if: steps.processors.outputs.processors == 'true' | |
run: | | |
mvn sonar:sonar \ | |
-Dsonar.projectKey=ENGINEERING.KPIDASHBOARD.PROCESSORS \ | |
-Dsonar.projectName=ENGINEERING.KPIDASHBOARD.PROCESSORS \ | |
-Dsonar.host.url=${{secrets.SONARQUBE_HOST}} \ | |
-Dsonar.branch.name=$GITHUB_HEAD_REF \ | |
-Dsonar.login=${{secrets.SONARQUBE_TOKEN}} -f processors/pom.xml -X | |
- name: Checking code Quality using SonarQube qg for processor | |
id: Sonarqgprocessor | |
if: steps.processors.outputs.processors == 'true' | |
run: | | |
chmod +x SonarDelay.sh | |
./SonarDelay.sh ./processors/target/sonar/report-task.txt ${{secrets.SONARQUBE_TOKEN}} ${{secrets.SONARQUBE_HOST}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Checking code Quality using SonarQube for Customapi | |
# if: steps.processors.outputs.processors == 'true' || steps.customapi.outputs.customapi == 'true' | |
# id: Sonarcustomapi | |
# run: | | |
# mvn sonar:sonar \ | |
# -Dsonar.projectKey=ENGINEERING.KPIDASHBOARD.CUSTOMAPI \ | |
# -Dsonar.projectName=ENGINEERING.KPIDASHBOARD.CUSTOMAPI \ | |
# -Dsonar.host.url=https://url.com/sonar \ | |
# -Dsonar.login= -f customapi/pom.xml | |
# chmod +x SonarDelay.sh | |
# ./SonarDelay.sh ./customapi/target/sonar/report-task.txt | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Send mail | |
if: failure() | |
uses: dawidd6/action-send-mail@v2 | |
with: | |
# mail server settings | |
server_address: | |
server_port: | |
# user credentials | |
username: | |
password: | |
# email subject | |
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }} | |
# email body as text | |
body: | | |
- ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }} | |
- CI triggered by: ${{ github.actor }} | |
- State of UI build is : ${{steps.BuildUI.outcome}} | |
- State of unit test of UI is: ${{steps.TestUI.outcome}} | |
- Sonar reports status of UI is: ${{steps.SonarUI.outcome}} | |
- Status of unit Test of customapi is : ${{steps.testcustomapi.outcome}} | |
- Status of unit test of jira_processor is : ${{steps.testjira.outcome}} | |
- Status of unit test of azure_processor is : ${{steps.testazure.outcome}} | |
- Status of unit test of devops_processor is : ${{steps.testdevops-processor.outcome}} | |
- Status of unit test of azure_pipeline_repo is : ${{steps.testazure-pipeline-repo.outcome}} | |
- Status of Sonarqube report of processor is : ${{steps.Sonarprocessor.outcome}} | |
- Status of Sonarqube report of customapi is : ${{steps.Sonarcustomapi.outcome}} | |
- click on the link for further details https://github.com/KnowHow/actions/runs/${{ github.run_id }} | |
# comma-separated string, send email to | |
to: | |
# from email name | |
from: GitHub | |
# - name: Run sonar for UI | |
# run: | | |
# cd UI | |
# sudo npm install -D sonarqube-scanner | |
# sudo npm run sonar | |
#- name: Check Coverage | |
# run: | | |
# cd UI | |
# npm install --save-dev @angular-devkit/build-angular | |
# sudo ng test --code-coverage | |
# sudo sed -i 's|SF:/var/jenkins_home/jobs/UI_Build/workspace/UI/|SF:|g' coverage/lcov.info | |
#- name: automerge | |
# uses: "pascalgn/automerge-action@v0.12.0" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MERGE_LABELS: "" | |
MERGE_REMOVE_LABELS: "" | |
MERGE_METHOD: "" | |
MERGE_COMMIT_MESSAGE: "pull-request-description" | |
MERGE_FORKS: "true" | |
MERGE_RETRIES: "6" | |
MERGE_RETRY_SLEEP: "10000" | |
UPDATE_LABELS: "" | |
UPDATE_METHOD: "rebase" |