mirror of https://github.com/asterisk/asterisk
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
6.0 KiB
157 lines
6.0 KiB
name: PROpenedOrUpdated
|
|
run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}"
|
|
on:
|
|
# workflow_dispatch:
|
|
pull_request_target:
|
|
types: [opened, reopened, synchronize]
|
|
|
|
#concurrency:
|
|
# group: ${{github.workflow}}-${{github.event.number}}
|
|
# cancel-in-progress: true
|
|
|
|
env:
|
|
ASTERISK_REPO: ${{github.repository}}
|
|
PR_NUMBER: ${{github.event.number}}
|
|
PR_COMMIT: ${{github.event.pull_request.head.sha}}
|
|
BRANCH: ${{github.event.pull_request.base.ref}}
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
MODULES_BLACKLIST: ${{vars.GATETEST_MODULES_BLACKLIST}} ${{vars.UNITTEST_MODULES_BLACKLIST}}
|
|
|
|
jobs:
|
|
|
|
AsteriskUnitTests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Add cherry-pick reminder
|
|
if: github.event.action == 'opened'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
cat <<-EOF | gh pr comment --repo ${{github.repository}} ${{env.PR_NUMBER}} -F -
|
|
REMINDER: If this PR applies to other branches, please add a
|
|
comment with the appropriate "cherry-pick-to" headers as per
|
|
the [Create a Pull Request](https://wiki.asterisk.org/wiki/display/AST/Code+Contribution#CodeContribution-CreateaPullRequest) process.
|
|
If you don't want it cherry-picked, please add a comment stating
|
|
"No cherry-picks required" so we don't keep asking.
|
|
|
|
If, after adding "cherry-pick-to" comments, you change your mind,
|
|
please edit the comment to DELETE the header lines and add
|
|
"No cherry-picks required".
|
|
EOF
|
|
|
|
- name: Set Labels
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh pr edit --repo ${{github.repository}} \
|
|
--remove-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
|
|
--remove-label ${{vars.TEST_CHECKS_FAILED_LABEL}} \
|
|
--remove-label ${{vars.TEST_GATES_PASSED_LABEL}} \
|
|
--remove-label ${{vars.TEST_GATES_FAILED_LABEL}} \
|
|
--remove-label ${{vars.CHERRY_PICK_CHECKS_PASSED_LABEL}} \
|
|
--remove-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
|
|
--remove-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \
|
|
--remove-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \
|
|
--add-label ${{vars.TESTING_IN_PROGRESS}} \
|
|
${{env.PR_NUMBER}} || :
|
|
|
|
- name: Run Unit Tests
|
|
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
|
|
with:
|
|
asterisk_repo: ${{env.ASTERISK_REPO}}
|
|
pr_number: ${{env.PR_NUMBER}}
|
|
base_branch: ${{env.BRANCH}}
|
|
modules_blacklist: ${{env.MODULES_BLACKLIST}}
|
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
|
unittest_command: ${{vars.UNITTEST_COMMAND}}
|
|
|
|
- name: Get Token needed to add reviewers
|
|
if: ${{ success() }}
|
|
id: get_workflow_token
|
|
uses: peter-murray/workflow-application-token-action@v1
|
|
with:
|
|
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
|
|
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
|
|
organization: asterisk
|
|
|
|
- name: Add Reviewers
|
|
if: ${{ success() }}
|
|
env:
|
|
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
|
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
|
REVIEWERS: ${{vars.PR_REVIEWERS}}
|
|
run: |
|
|
echo "${{env.GITHUB_ACTION}} Add reviewers"
|
|
IFS=$'; \n'
|
|
for r in $REVIEWERS ; do
|
|
gh pr edit --repo ${ASTERISK_REPO} ${PR_NUMBER} --add-reviewer $r
|
|
done
|
|
gh pr edit --repo ${{github.repository}} \
|
|
--add-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
|
|
${{env.PR_NUMBER}} || :
|
|
|
|
AsteriskGate:
|
|
needs: AsteriskUnitTests
|
|
continue-on-error: false
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
group: ${{ fromJSON(vars.GATETEST_LIST) }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: runtest
|
|
name: Run Gate Tests for ${{ matrix.group }}
|
|
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
|
|
with:
|
|
test_type: Gate
|
|
asterisk_repo: ${{env.ASTERISK_REPO}}
|
|
pr_number: ${{env.PR_NUMBER}}
|
|
base_branch: ${{env.BRANCH}}
|
|
modules_blacklist: ${{env.MODULES_BLACKLIST}}
|
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
|
testsuite_repo: ${{vars.TESTSUITE_REPO}}
|
|
gatetest_group: ${{matrix.group}}
|
|
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
|
|
|
|
|
|
AsteriskGateTests:
|
|
name: AsteriskGateTests
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
needs: AsteriskGate
|
|
steps:
|
|
- name: Check test matrix status
|
|
env:
|
|
RESULT: ${{ needs.AsteriskGate.result }}
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
echo "all results: ${{ toJSON(needs.*.result) }}"
|
|
echo "composite result: ${{ needs.AsteriskGate.result }}"
|
|
|
|
gh pr edit --repo ${{github.repository}} \
|
|
--remove-label ${{vars.TESTING_IN_PROGRESS}} \
|
|
${{env.PR_NUMBER}} || :
|
|
|
|
case $RESULT in
|
|
success)
|
|
gh pr edit --repo ${{github.repository}} \
|
|
--add-label ${{vars.TEST_GATES_PASSED_LABEL}} \
|
|
${{env.PR_NUMBER}} || :
|
|
echo "::notice::All Testsuite tests passed"
|
|
exit 0
|
|
;;
|
|
skipped)
|
|
gh pr edit --repo ${{github.repository}} \
|
|
--add-label ${{vars.TEST_CHECKS_FAILED_LABEL}} \
|
|
${{env.PR_NUMBER}} || :
|
|
echo "::error::Testsuite tests were skipped because of an earlier failure"
|
|
exit 1
|
|
;;
|
|
*)
|
|
gh pr edit --repo ${{github.repository}} \
|
|
--add-label ${{vars.TEST_GATES_FAILED_LABEL}} \
|
|
${{env.PR_NUMBER}} || :
|
|
echo "::error::One or more Testsuite tests failed ($RESULT)"
|
|
exit 1
|
|
esac
|