Move shared workflows to .github/workflows
The assumption that shared workflows could be in a non-standard
directory was incorrect. All workflows, included shared ones, need to
be stored it .github/workflows to be valid. These will still not be
called on push to this repo, due to naming standards.
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
Change-Id: Icd35816c544a1fb9894402a2eedd6be5ec44161e
diff --git a/.github/workflows/verify-unit-tests.yaml b/.github/workflows/verify-unit-tests.yaml
new file mode 100644
index 0000000..54c77b3
--- /dev/null
+++ b/.github/workflows/verify-unit-tests.yaml
@@ -0,0 +1,148 @@
+---
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: 2026 The Linux Foundation
+name: Gerrit Verify - Unit Tests
+
+# yamllint disable-line rule:truthy
+on:
+ workflow_dispatch:
+ inputs:
+ # Gerrit-to-Github defaults
+ GERRIT_BRANCH:
+ description: "Branch that change is against"
+ required: true
+ type: string
+ GERRIT_CHANGE_ID:
+ description: "The ID for the change"
+ required: true
+ type: string
+ GERRIT_CHANGE_NUMBER:
+ description: "The Gerrit number"
+ required: true
+ type: string
+ GERRIT_CHANGE_URL:
+ description: "URL to the change"
+ required: true
+ type: string
+ GERRIT_EVENT_TYPE:
+ description: "Type of Gerrit event"
+ required: true
+ type: string
+ GERRIT_PATCHSET_NUMBER:
+ description: "The patch number for the change"
+ required: true
+ type: string
+ GERRIT_PATCHSET_REVISION:
+ description: "The revision sha"
+ required: true
+ type: string
+ GERRIT_PROJECT:
+ description: "Project in Gerrit"
+ required: true
+ type: string
+ GERRIT_REFSPEC:
+ description: "Gerrit refspec of change"
+ required: true
+ type: string
+ # Workflow-specific inputs
+ UNIT_TEST_TARGETS:
+ description: "List of targets in json-formatted string"
+ required: false
+ type: string
+ default: '["lint", "sca", "test"]'
+ DEST_GOPATH:
+ description: "Specifies part of the GOPATH. Usually set to Github org."
+ required: false
+ type: string
+ default: "github.com/opencord"
+ GOPROXY:
+ description: "Url for Go proxy"
+ required: false
+ type: string
+ default: "https://proxy.golang.org"
+
+concurrency:
+ # yamllint disable-line rule:line-length
+ group: verify-unit-tests-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ prepare:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Clear votes
+ # yamllint disable-line rule:line-length
+ uses: lfreleng-actions/gerrit-review-action@537251ec667665b386f70b330b05446e3fc29087 # v0.9
+ with:
+ host: ${{ vars.GERRIT_SERVER }}
+ username: ${{ vars.GERRIT_SSH_USER }}
+ key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
+ known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
+ gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
+ gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
+ vote-type: clear
+ comment-only: false
+ - name: Allow replication
+ run: sleep 10s
+
+ unit-tests:
+ needs: prepare
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ target: ${{ fromJSON(inputs.UNIT_TEST_TARGETS) }}
+ steps:
+ - name: Gerrit Checkout
+ # yamllint disable-line rule:line-length
+ uses: lfit/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9
+ with:
+ gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
+ gerrit-project: ${{ inputs.GERRIT_PROJECT }}
+ gerrit-url: ${{ vars.GERRIT_URL }}
+ delay: "0s"
+ submodules: "true"
+ fetch-depth: 0
+ # yamllint disable-line rule:line-length
+ - name: Install python
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
+ with:
+ python-version: "3.10"
+ - name: Install virtualenv
+ run: pip install virtualenv
+ - name: Install Go
+ uses: actions/setup-go@v5
+ with:
+ go-version-file: go.mod
+ - name: Check License Headers
+ uses: ./.github/actions/license-check-action
+ - name: Run unit tests
+ env:
+ DEST_GOPATH: ${{ inputs.DEST_GOPATH }}
+ UNIT_TEST_TARGETS: ${{ matrix.target }}
+ GOPROXY: ${{ inputs.GOPROXY }}
+ TEST_PROJECT: ${{ github.repository }}
+ WORKSPACE: ${{ github.workspace }}
+ run: |
+ make SHELL="/bin/bash" ${{ matrix.target }}
+
+ vote:
+ if: ${{ always() }}
+ # yamllint enable rule:line-length
+ needs: [prepare, unit-tests]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Get conclusion
+ # yamllint disable-line rule:line-length
+ uses: im-open/workflow-conclusion@e4f7c4980600fbe0818173e30931d3550801b992 # v2.2.3
+ - name: Set vote
+ # yamllint disable-line rule:line-length
+ uses: lfreleng-actions/gerrit-review-action@537251ec667665b386f70b330b05446e3fc29087 # v0.9
+ with:
+ host: ${{ vars.GERRIT_SERVER }}
+ username: ${{ vars.GERRIT_SSH_USER }}
+ key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
+ known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
+ gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
+ gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
+ vote-type: ${{ env.WORKFLOW_CONCLUSION }}
+ comment-only: false