-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (89 loc) · 3.95 KB
/
Processors_CI_Workflow.yaml
File metadata and controls
104 lines (89 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Processors_CI_Workflow # Define the name of the workflow
# Define when the workflow should trigger
on:
pull_request:
types:
- labeled # Trigger when a label is added
- unlabeled # Trigger when a label is removed
- synchronize # Trigger when commits are pushed to the PR
- opened # Trigger when a PR is opened
- edited # Trigger when a PR title or description is edited
- ready_for_review # Trigger when a draft PR is marked as ready
- reopened # Trigger when a closed PR is reopened
- unlocked # Trigger when a locked PR is unlocked
branches: [master, develop, qa-master] # Apply to these branches
pull_request_review:
types: [edited, dismissed] # Trigger when a review is edited or dismissed
branches: [master, develop, qa-master]
workflow_dispatch: # Allow manual triggering of the workflow
# Define environment variables
env:
GITHUB_HEAD_NAME: $GITHUB_HEAD_REF # Store the head branch name
sonartoken: ${{ secrets.SONARQUBE_TOKEN }} # Secret for SonarQube authentication
sonarurl: ${{ secrets.SONARURL }} # SonarQube URL stored in secrets
jobs:
# ✅ Building & Testing Processors
processors_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set Up Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Clone & Build knowhow-common dependency
run: |
git clone --branch ${{ github.event.pull_request.base.ref }} https://github.com/PublicisSapient/knowhow-common.git
cd knowhow-common
mvn clean install -Ddockerfile.skip=true -X
- name: Get common version using Maven Help Plugin
run: |
cd knowhow-common
COMMON_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "COMMON_VERSION=$COMMON_VERSION"
echo "COMMON_VERSION=$COMMON_VERSION" >> $GITHUB_ENV
- name: Build & Test Jira Processor
run: |
mvn clean install -Pjira-processor -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION
- name: Build & Test Azure Board Processor
run: mvn clean install -Pazure-board-processor -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION
- name: Build & Test DevOps Processor
run: mvn clean install -Pdevops-processor -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION
- name: Build & Test Azure Pipeline Repo Processor
run: mvn clean install -Pazure-pipeline-repo -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION
- name: SonarQube Analysis - Processors
run: |
mvn sonar:sonar -Dsonar.projectKey=ENGINEERING.KPIDASHBOARD.PROCESSORS \
-Dsonar.projectName=ENGINEERING.KPIDASHBOARD.PROCESSORS \
-Dsonar.branch.name=${{ env.GITHUB_HEAD_NAME }} \
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} \
-Dcommon.version=$COMMON_VERSION \
-Dsonar.login=${{ secrets.SONARQUBE_TOKEN }} -f pom.xml
- name: Check SonarQube Quality Gate - Processors
run: |
chmod +x SonarQG.sh
./SonarQG.sh ./target/sonar/report-task.txt
# ✅ Final Job to Ensure Completion
GitHub_CI_Complete:
needs: [processors_ci]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check Job Status
run: |
if [[ "${{ needs.processors_ci.result }}" == "failure" || \
"${{ needs.processors_ci.result }}" == "cancelled" ]]; then
echo "❌ One or more jobs failed or were cancelled. Failing CI."
exit 1
else
echo "✅ All relevant jobs have passed."
fi