blob: 9e83340d215ba2ed0ec685309964b6badec62957 [file] [log] [blame]
Jessica Wagantall3828b652024-04-04 13:53:54 -07001---
2name: Gerrit Merge
3
4# yamllint disable-line rule:truthy
5on:
6 workflow_dispatch:
7 inputs:
8 GERRIT_BRANCH:
9 description: "Branch that change is against"
10 required: true
11 type: string
12 GERRIT_CHANGE_ID:
13 description: "The ID for the change"
14 required: true
15 type: string
16 GERRIT_CHANGE_NUMBER:
17 description: "The Gerrit number"
18 required: true
19 type: string
20 GERRIT_CHANGE_URL:
21 description: "URL to the change"
22 required: true
23 type: string
24 GERRIT_EVENT_TYPE:
25 description: "Type of Gerrit event"
26 required: true
27 type: string
28 GERRIT_PATCHSET_NUMBER:
29 description: "The patch number for the change"
30 required: true
31 type: string
32 GERRIT_PATCHSET_REVISION:
33 description: "The revision sha"
34 required: true
35 type: string
36 GERRIT_PROJECT:
37 description: "Project in Gerrit"
38 required: true
39 type: string
40 GERRIT_REFSPEC:
41 description: "Gerrit refspec of change"
42 required: true
43 type: string
44 secrets:
45 SONAR_TOKEN:
46 description: "Sonar Cloud access token"
47 required: true
48
49concurrency:
50 # yamllint disable-line rule:line-length
51 group: gerrit-merge-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
52 cancel-in-progress: true
53
54jobs:
55 notify:
56 runs-on: ubuntu-latest
57 steps:
58 - name: Notify job start
59 # yamllint disable-line rule:line-length
60 uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729 # v0.8
61 with:
62 host: ${{ vars.GERRIT_SERVER }}
63 username: ${{ vars.GERRIT_SSH_USER }}
64 key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
65 known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
66 gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
67 gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
68 vote-type: clear
69 comment-only: true
70 - name: Allow replication
71 run: sleep 10s
72
73 call-sonarcloud-scan:
74 runs-on: ubuntu-latest
75 needs: notify
76 steps:
77 - uses: actions/checkout@v4
78 with:
79 ref: ${{ inputs.GERRIT_BRANCH }}
80 submodules: "true"
81 - name: Run SonarCloud Scan
82 uses: sonarsource/sonarcloud-github-action@master
83 env:
84 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
85 with:
86 args: >
87 -Dsonar.build.sourceEncoding=UTF-8
88 -Dsonar.organization=o-ran-sc
89 -Dsonar.projectBaseDir=.
90 -Dsonar.projectKey=o-ran-sc_ric-plt-xapp-frame-py
91 -Dsonar.projectName=ric-plt-xapp-frame-py
92 -Dsonar.exclusions=setup.py,tests/*.py
93 -Dsonar.python.coverage.reportPaths=./coverage.xml
94 -Dsonar.sources=ricxappframe
95 -Dsonar.verbose=true
96
97 report-status:
98 if: ${{ always() }}
99 needs: [notify, call-sonarcloud-scan]
100 runs-on: ubuntu-latest
101 steps:
102 - name: Get workflow conclusion
103 uses: technote-space/workflow-conclusion-action@v3
104 - name: Report workflow conclusion
105 # yamllint disable-line rule:line-length
106 uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729 # v0.8
107 with:
108 host: ${{ vars.GERRIT_SERVER }}
109 username: ${{ vars.GERRIT_SSH_USER }}
110 key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
111 known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
112 gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
113 gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
114 vote-type: ${{ env.WORKFLOW_CONCLUSION }}
115 comment-only: true