| Eric Ball | 51e27f4 | 2026-02-03 07:51:28 -0800 | [diff] [blame^] | 1 | --- |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # SPDX-FileCopyrightText: 2026 The Linux Foundation |
| 4 | name: Gerrit Verify - License Check |
| 5 | |
| 6 | # yamllint disable-line rule:truthy |
| 7 | on: |
| 8 | workflow_dispatch: |
| 9 | 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" |
| 52 | |
| 53 | concurrency: |
| 54 | # yamllint disable-line rule:line-length |
| 55 | group: verify-onos-component-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }} |
| 56 | cancel-in-progress: true |
| 57 | |
| 58 | jobs: |
| 59 | prepare: |
| 60 | runs-on: ubuntu-latest |
| 61 | steps: |
| 62 | - name: Clear votes |
| 63 | # yamllint disable-line rule:line-length |
| 64 | uses: lfreleng-actions/gerrit-review-action@537251ec667665b386f70b330b05446e3fc29087 # v0.9 |
| 65 | with: |
| 66 | host: ${{ vars.GERRIT_SERVER }} |
| 67 | username: ${{ vars.GERRIT_SSH_USER }} |
| 68 | key: ${{ secrets.GERRIT_SSH_PRIVKEY }} |
| 69 | known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }} |
| 70 | gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }} |
| 71 | gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }} |
| 72 | vote-type: clear |
| 73 | comment-only: ${{ inputs.comment-only }} |
| 74 | - name: Allow replication |
| 75 | run: sleep 10s |
| 76 | |
| 77 | verify-onos-component: |
| 78 | needs: prepare |
| 79 | runs-on: ubuntu-latest |
| 80 | steps: |
| 81 | # yamllint disable-line rule:line-length |
| 82 | - uses: lfreleng-actions/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9 |
| 83 | with: |
| 84 | gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} |
| 85 | gerrit-project: ${{ inputs.GERRIT_PROJECT }} |
| 86 | gerrit-url: ${{ vars.GERRIT_URL }} |
| 87 | delay: "0s" |
| 88 | - name: Check License Headers |
| 89 | uses: ./.github/actions/license-check-action |
| 90 | - name: Run Maven |
| 91 | # yamllint disable-line rule:line-length |
| 92 | uses: lfreleng-actions/maven-build-action@5be56aed8bed4f0bf9d699f2817eaef37c94ac02 # v0.2.0 |
| 93 | with: |
| 94 | jdk-version: "11" |
| 95 | mvn-version: "3.3.9" |
| 96 | mvn-phases: "clean test install spotbugs:check" |
| 97 | mvn-profiles: "ci-verify" |
| 98 | |
| 99 | vote: |
| 100 | if: ${{ always() }} |
| 101 | # yamllint enable rule:line-length |
| 102 | needs: [prepare, verify-onos-component] |
| 103 | runs-on: ubuntu-latest |
| 104 | steps: |
| 105 | - name: Get conclusion |
| 106 | # yamllint disable-line rule:line-length |
| 107 | uses: im-open/workflow-conclusion@e4f7c4980600fbe0818173e30931d3550801b992 # v2.2.3 |
| 108 | - name: Set vote |
| 109 | # yamllint disable-line rule:line-length |
| 110 | uses: lfreleng-actions/gerrit-review-action@537251ec667665b386f70b330b05446e3fc29087 # v0.9 |
| 111 | with: |
| 112 | host: ${{ vars.GERRIT_SERVER }} |
| 113 | username: ${{ vars.GERRIT_SSH_USER }} |
| 114 | key: ${{ secrets.GERRIT_SSH_PRIVKEY }} |
| 115 | known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }} |
| 116 | gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }} |
| 117 | gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }} |
| 118 | vote-type: ${{ env.WORKFLOW_CONCLUSION }} |
| 119 | comment-only: ${{ inputs.comment-only }} |