PR 72 synchronize by seanbright #88
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PRSubmitTests | |
run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}" | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
concurrency: | |
group: ${{github.workflow}}-${{github.event.number}} | |
cancel-in-progress: true | |
env: | |
TESTSUITE_REPO: ${{github.repository}} | |
PR_NUMBER: ${{github.event.number}} | |
PR_COMMIT: ${{github.event.pull_request.head.sha}} | |
BRANCH: ${{github.event.pull_request.base.ref}} | |
jobs: | |
# | |
# Pull requests created from forked respositories don't have access to | |
# the "Action Variables" ('vars' context) so we need to retrieve control | |
# data from an action. | |
# | |
PRSGetControlData: | |
runs-on: ubuntu-latest | |
outputs: | |
control_data: ${{ steps.setvars.outputs.control_data }} | |
steps: | |
- id: setvars | |
uses: asterisk/asterisk-ci-actions/GetRepoControlData@main | |
with: | |
repo: ${{ github.event.repository.name}} | |
- name: DumpEnvironment | |
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main | |
with: | |
action-inputs: ${{toJSON(inputs)}} | |
action-vars: ${{ toJSON(steps.setvars.outputs) }} | |
PRSUnitTests: | |
needs: PRSGetControlData | |
runs-on: ubuntu-latest | |
env: | |
UNITTEST_COMMAND: ${{ fromJSON(needs.PRSGetControlData.outputs.control_data).UNITTEST_COMMAND }} | |
ASTERISK_REPO: ${{ fromJSON(needs.PRSGetControlData.outputs.control_data).ASTERISK_REPO }} | |
steps: | |
- name: Run Unit Tests | |
uses: asterisk/asterisk-ci-actions/TestsuiteUnitComposite@main | |
with: | |
asterisk_repo: ${{env.ASTERISK_REPO}} | |
testsuite_repo: ${{env.TESTSUITE_REPO}} | |
pr_number: ${{env.PR_NUMBER}} | |
base_branch: ${{env.BRANCH}} | |
unittest_command: ${{env.UNITTEST_COMMAND}} | |
PRSTestResults: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: [PRSUnitTests] | |
steps: | |
- name: Check test matrix status | |
env: | |
RESULT_UNIT: ${{ needs.PRSUnitTests.result }} | |
run: | | |
declare -i rc=0 | |
echo "all results: ${{ toJSON(needs.*.result) }}" | |
case $RESULT_UNIT in | |
success) | |
echo "::notice::Unit tests passed" | |
;; | |
skipped) | |
echo "::error::Unit tests were skipped because of an earlier failure" | |
rc+=1 | |
;; | |
*) | |
echo "::error::One or more unit tests failed ($RESULT_UNIT)" | |
rc+=1 | |
esac | |
echo "::notice::Final result code: $rc" | |
exit $rc |