| Eric Ball | 8f40444 | 2026-01-05 21:31:56 -0800 | [diff] [blame^] | 1 | --- |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # SPDX-FileCopyrightText: 2026 The Linux Foundation |
| 4 | name: Gerrit Verify - Maven |
| 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 | # Needed for maven-build-action |
| 48 | JDK_VERSION: |
| 49 | description: "OpenJDK version" |
| 50 | required: false |
| 51 | default: "17" |
| 52 | type: string |
| 53 | MVN_VERSION: |
| 54 | description: "Maven version" |
| 55 | required: false |
| 56 | default: "3.8.2" |
| 57 | type: stringssh://eball@gerrit.lfbroadband.org:29418/shared-workflows |
| 58 | MVN_PARAMS: |
| 59 | description: "Maven parameters to pass to the mvn command" |
| 60 | required: false |
| 61 | default: "" |
| 62 | type: string |
| 63 | MVN_PHASES: |
| 64 | description: "Comma separated list of phases to execute" |
| 65 | required: false |
| 66 | default: "clean deploy" |
| 67 | type: string |
| 68 | MVN_OPTS: |
| 69 | description: "Maven options" |
| 70 | required: false |
| 71 | # yamllint disable rule:line-length |
| 72 | default: >- |
| 73 | -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn |
| 74 | -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r |
| 75 | -DaltDeploymentRepository=staging::default::file:"${GITHUB_WORKSPACE}"/m2repo |
| 76 | # yamllint enable rule:line-length |
| 77 | type: string |
| 78 | MVN_POM_FILE: |
| 79 | description: "Path to pom.xml file." |
| 80 | required: false |
| 81 | default: "pom.xml" |
| 82 | type: string |
| 83 | MVN_PROFILES: |
| 84 | description: "Comma-delimited list of profiles to activate" |
| 85 | required: false |
| 86 | default: "" |
| 87 | type: string |
| 88 | MVN_GLOBAL_SETTINGS: |
| 89 | description: "Maven global settings configuration." |
| 90 | required: false |
| 91 | default: ${{ vars.GLOBAL_SETTINGS }} |
| 92 | type: string |
| 93 | ENV_VARS: |
| 94 | # yamllint disable-line rule:line-length |
| 95 | description: "Pass GitHub variables to be exported as environment variables via `toJSON(vars)` or specific variables encoded in JSON format" |
| 96 | required: false |
| 97 | default: "{}" |
| 98 | type: string |
| 99 | ENV_SECRETS: |
| 100 | # yamllint disable-line rule:line-length |
| 101 | description: "Pass GitHub secrets to be exported as environment variables via `toJSON(secrets)` or specific secrets encoded in JSON format" |
| 102 | required: false |
| 103 | default: "{}" |
| 104 | type: string |
| 105 | |
| 106 | concurrency: |
| 107 | # yamllint disable-line rule:line-length |
| 108 | group: verify-maven-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }} |
| 109 | cancel-in-progress: true |
| 110 | |
| 111 | jobs: |
| 112 | maven-verify: |
| 113 | runs-on: ubuntu-latest |
| 114 | steps: |
| 115 | # yamllint disable-line rule:line-length |
| 116 | - uses: lfreleng-actions/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9 |
| 117 | with: |
| 118 | gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} |
| 119 | gerrit-project: ${{ inputs.GERRIT_PROJECT }} |
| 120 | gerrit-url: ${{ vars.GERRIT_URL }} |
| 121 | delay: "0s" |
| 122 | - name: Run Maven |
| 123 | # yamllint disable-line rule:line-length |
| 124 | uses: lfreleng-actions/maven-build-action@5be56aed8bed4f0bf9d699f2817eaef37c94ac02 # v0.2.0 |
| 125 | with: |
| 126 | java-version: ${{ inputs.JDK_VERSION }} |
| 127 | mvn-version: ${{ inputs.MVN_VERSION }} |
| 128 | mvn-params: ${{ inputs.MVN_PARAMS }} |
| 129 | mvn-phases: ${{ inputs.MVN_PHASES }} |
| 130 | mvn-opts: ${{ inputs.MVN_OPTS }} |
| 131 | mvn-pom-file: ${{ inputs.MVN_POM_FILE }} |
| 132 | mvn-profiles: ${{ inputs.MVN_PROFILES }} |
| 133 | env-vars: ${{ inputs.ENV_VARS }} |
| 134 | env-secrets: ${{ inputs.ENV_SECRETS }} |
| 135 | global-settings: ${{ inputs.MVN_GLOBAL_SETTINGS }} |