ci: Add reusable unit test workflow (no-changelog) (#7159)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
committed by
GitHub
parent
a6e027b3ff
commit
c11dfbbe00
39
.github/workflows/units-tests-dispatch.yml
vendored
Normal file
39
.github/workflows/units-tests-dispatch.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Runs unit tests for a given ref
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'GitHub ref to test.'
|
||||
required: false
|
||||
default: 'master'
|
||||
type: string
|
||||
prNumber:
|
||||
description: 'PR number to run tests for.'
|
||||
required: false
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
branch: ${{ steps.compute-branch.outputs.branch }}
|
||||
steps:
|
||||
- name: Compute branch
|
||||
id: compute-branch
|
||||
run: |
|
||||
BRANCH_NAME=""
|
||||
if [[ "${{ inputs.prNumber }}" != "" && "${{ inputs.prNumber }}" != "null" ]]; then
|
||||
BRANCH_NAME="refs/pull/${{ inputs.prNumber }}/merge"
|
||||
else
|
||||
BRANCH_NAME="${{ inputs.ref }}"
|
||||
fi
|
||||
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
||||
|
||||
unit-test:
|
||||
name: Unit tests
|
||||
needs: prepare
|
||||
uses: ./.github/workflows/units-tests-reusable.yml
|
||||
with:
|
||||
ref: ${{ needs.prepare.outputs.branch }}
|
||||
Reference in New Issue
Block a user