d1a1902abaa33f78d123de7854fe6858065061a5
[sim/a1-interface.git] / .github / workflows / gerrit-novote-verify.yaml
1 ---
2 name: Gerrit Verify
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_PROJECT:
33         description: "Project in Gerrit"
34         required: true
35         type: string
36       GERRIT_REFSPEC:
37         description: "Gerrit refspec of change"
38         required: true
39         type: string
40       TARGET_REPO:
41         # yamllint disable-line rule:line-length
42         description: "The target GitHub repository needing the required workflow"
43         required: false
44         default: ${{ github.repository }}
45         type: string
46       TOX_ENVS:
47         description: "Map of versions and envs to run"
48         required: true
49         type: string
50
51 concurrency:
52   # yamllint disable-line rule:line-length
53   group: gerrit-verify-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
54   cancel-in-progress: true
55
56 permissions: read-all
57
58 jobs:
59   prepare:
60     runs-on: ubuntu-latest
61     steps:
62       - name: Clear votes
63         uses: lfit/gerrit-review-action@v0.4
64         with:
65           host: ${{ vars.GERRIT_SERVER }}
66           username: ${{ vars.GERRIT_SSH_REQUIRED_USER }}
67           key: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }}
68           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
69           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
70           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
71           vote-type: clear
72           comment-only: "true"
73       - name: Allow replication
74         run: sleep 10s
75
76   call-gerrit-tox-verify:
77     needs: prepare
78     # yamllint disable-line rule:line-length
79     uses: lfit/releng-reusable-workflows/.github/workflows/gerrit-compose-required-tox-verify.yaml@main
80     with:
81       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
82       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
83       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
84       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
85       TARGET_REPO: ${{ inputs.TARGET_REPO }}
86       TOX_ENVS: "code"
87
88   vote:
89     if: ${{ always() }}
90     # yamllint enable rule:line-length
91     needs: [prepare, call-gerrit-tox-verify]
92     runs-on: ubuntu-latest
93     steps:
94       - uses: technote-space/workflow-conclusion-action@v3
95       - name: Set vote
96         uses: lfit/gerrit-review-action@v0.4
97         with:
98           host: ${{ vars.GERRIT_SERVER }}
99           username: ${{ vars.GERRIT_SSH_REQUIRED_USER }}
100           key: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }}
101           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
102           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
103           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
104           vote-type: ${{ env.WORKFLOW_CONCLUSION }}
105           comment-only: "true"