04736db4d3456d5762e5b8e3ee4db5862ee806b7
[com/pylog.git] / .github / workflows / gerrit-novote-merge.yaml
1 ---
2 name: Gerrit Merge
3
4 # yamllint disable-line rule:truthy
5 on:
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
45 concurrency:
46   # yamllint disable-line rule:line-length
47   group: gerrit-merge-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
48   cancel-in-progress: true
49
50 permissions: read-all
51
52 jobs:
53   notify:
54     runs-on: ubuntu-latest
55     steps:
56       - name: Notify job start
57         # yamllint disable-line rule:line-length
58         uses: lfit/gerrit-review-action@7c30179c3c9389545fccb0d458df59879372ae6a  # v0.6
59         with:
60           host: ${{ vars.GERRIT_SERVER }}
61           username: ${{ vars.GERRIT_SSH_USER }}
62           key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
63           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
64           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
65           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
66           vote-type: clear
67           comment-only: true
68       - name: Allow replication
69         run: sleep 10s
70
71   call-gerrit-tox-sonarcloud:
72     needs: notify
73     # yamllint disable-line rule:line-length
74     uses: lfit/releng-reusable-workflows/.github/workflows/composed-tox-sonar-cloud.yaml@main
75     with:
76       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
77       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
78       GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
79       GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
80       GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
81       GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
82       GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
83       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
84       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
85       TOX_ENVS: '["py3"]'
86       SONAR_PROJECT_KEY: "o-ran-sc_com-pylog"
87       SONAR_ORG: "o-ran-sc"
88       SONAR_ARGS: >
89         -Dsonar.sources=mdclogpy
90         -Dsonar.python.coverage.reportPaths=./coverage.xm
91         -Dsonar.verbose=true
92     secrets:
93       SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
94
95   report-status:
96     if: ${{ always() }}
97     needs: [notify, call-gerrit-tox-sonarcloud]
98     runs-on: ubuntu-latest
99     steps:
100       - name: Get workflow conclusion
101         uses: technote-space/workflow-conclusion-action@v3
102       - name: Report workflow conclusion
103         # yamllint disable-line rule:line-length
104         uses: lfit/gerrit-review-action@7c30179c3c9389545fccb0d458df59879372ae6a  # v0.6
105         with:
106           host: ${{ vars.GERRIT_SERVER }}
107           username: ${{ vars.GERRIT_SSH_USER }}
108           key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
109           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
110           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
111           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
112           vote-type: ${{ env.WORKFLOW_CONCLUSION }}
113           comment-only: true