blob: 47bd49409bd2fdc2d05d43afbc3ffc13fe18ab5c [file] [log] [blame]
Eric Ball51e27f42026-02-03 07:51:28 -08001---
2# SPDX-License-Identifier: Apache-2.0
3# SPDX-FileCopyrightText: 2026 The Linux Foundation
4name: Gerrit Verify - License Check
5
6# yamllint disable-line rule:truthy
7on:
Eric Balla4700f02026-04-20 17:34:07 -07008 workflow_call:
Eric Ball51e27f42026-02-03 07:51:28 -08009 inputs:
10 # Gerrit-to-Github defaults
11 GERRIT_BRANCH:
12 description: "Branch that change is against"
13 required: true
14 type: string
15 GERRIT_CHANGE_ID:
16 description: "The ID for the change"
17 required: true
18 type: string
19 GERRIT_CHANGE_NUMBER:
20 description: "The Gerrit number"
21 required: true
22 type: string
23 GERRIT_CHANGE_URL:
24 description: "URL to the change"
25 required: true
26 type: string
27 GERRIT_EVENT_TYPE:
28 description: "Type of Gerrit event"
29 required: true
30 type: string
31 GERRIT_PATCHSET_NUMBER:
32 description: "The patch number for the change"
33 required: true
34 type: string
35 GERRIT_PATCHSET_REVISION:
36 description: "The revision sha"
37 required: true
38 type: string
39 GERRIT_PROJECT:
40 description: "Project in Gerrit"
41 required: true
42 type: string
43 GERRIT_REFSPEC:
44 description: "Gerrit refspec of change"
45 required: true
46 type: string
47 comment-only:
48 description: "Make this workflow advisory only, default false"
49 required: false
50 type: string
51 default: "false"
Eric Ball1aa07c02026-04-20 18:16:08 -070052 secrets:
53 GERRIT_SSH_PRIVKEY:
54 description: "SSH Key for the authorized user account"
55 required: true
Eric Ball51e27f42026-02-03 07:51:28 -080056
57concurrency:
58 # yamllint disable-line rule:line-length
59 group: verify-onos-component-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
60 cancel-in-progress: true
61
62jobs:
63 prepare:
64 runs-on: ubuntu-latest
65 steps:
66 - name: Clear votes
67 # yamllint disable-line rule:line-length
68 uses: lfreleng-actions/gerrit-review-action@537251ec667665b386f70b330b05446e3fc29087 # v0.9
69 with:
70 host: ${{ vars.GERRIT_SERVER }}
71 username: ${{ vars.GERRIT_SSH_USER }}
72 key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
73 known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
74 gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
75 gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
76 vote-type: clear
77 comment-only: ${{ inputs.comment-only }}
78 - name: Allow replication
79 run: sleep 10s
80
81 verify-onos-component:
82 needs: prepare
83 runs-on: ubuntu-latest
84 steps:
85 # yamllint disable-line rule:line-length
86 - uses: lfreleng-actions/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9
87 with:
88 gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
89 gerrit-project: ${{ inputs.GERRIT_PROJECT }}
90 gerrit-url: ${{ vars.GERRIT_URL }}
91 delay: "0s"
92 - name: Check License Headers
93 uses: ./.github/actions/license-check-action
94 - name: Run Maven
95 # yamllint disable-line rule:line-length
96 uses: lfreleng-actions/maven-build-action@5be56aed8bed4f0bf9d699f2817eaef37c94ac02 # v0.2.0
97 with:
98 jdk-version: "11"
99 mvn-version: "3.3.9"
100 mvn-phases: "clean test install spotbugs:check"
101 mvn-profiles: "ci-verify"
102
Eric Ball01fcab42026-04-17 15:23:22 -0700103 vote:
104 if: ${{ always() }}
105 # yamllint enable rule:line-length
106 needs: [prepare, verify-onos-component]
107 runs-on: ubuntu-latest
108 steps:
109 - name: Get conclusion
110 # yamllint disable-line rule:line-length
111 uses: im-open/workflow-conclusion@e4f7c4980600fbe0818173e30931d3550801b992 # v2.2.3
112 - name: Set vote
113 # yamllint disable-line rule:line-length
114 uses: lfreleng-actions/gerrit-review-action@537251ec667665b386f70b330b05446e3fc29087 # v0.9
115 with:
116 host: ${{ vars.GERRIT_SERVER }}
117 username: ${{ vars.GERRIT_SSH_USER }}
118 key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
119 known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
120 gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
121 gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
122 vote-type: ${{ env.WORKFLOW_CONCLUSION }}
123 comment-only: ${{ inputs.comment-only }}