Initial GitHub PRs

(cherry picked from commit 987315a5fa)
This commit is contained in:
George Joseph 2023-04-28 12:31:03 -06:00 committed by Asterisk Development Team
parent f994463aee
commit cc36ae8de5
5 changed files with 416 additions and 0 deletions

137
.github/workflows/CherryPickTest.yml vendored Normal file
View File

@ -0,0 +1,137 @@
name: CherryPickTest
run-name: "Cherry-Pick Tests for PR ${{github.event.number || inputs.pr_number}}"
on:
pull_request_target:
types: [ labeled ]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number'
required: true
type: number
concurrency:
group: ${{github.workflow}}-${{github.event.number || inputs.pr_number }}
cancel-in-progress: true
env:
PR_NUMBER: ${{ github.event.number || inputs.pr_number }}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
jobs:
IdentifyBranches:
name: IdentifyBranches
if: github.event.label.name == ${{vars.CHERRY_PICK_TEST_LABEL}}
outputs:
branches: ${{ steps.getbranches.outputs.branches }}
branch_count: ${{ steps.getbranches.outputs.branch_count }}
runs-on: ubuntu-latest
steps:
- name: Remove Trigger Label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.CHERRY_PICK_TEST_LABEL}} ${{env.PR_NUMBER}} || :
- name: Get cherry-pick branches
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
id: getbranches
with:
repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
cherry_pick_test_label: ${{vars.CHERRY_PICK_TEST_LABEL}}
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
github_token: ${{secrets.GITHUB_TOKEN}}
AsteriskUnitTestMatrix:
needs: [ IdentifyBranches ]
if: needs.IdentifyBranches.outputs.branch_count > 0
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.IdentifyBranches.outputs.branches) }}
runs-on: ubuntu-latest
steps:
- name: Run Unit Tests for branch ${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
with:
asterisk_repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.branch}}
is_cherry_pick: true
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
unittest_command: ${{vars.UNITTEST_COMMAND}}
AsteriskUnitTests:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [ AsteriskUnitTestMatrix ]
steps:
- name: Check unit test matrix status
env:
RESULT: ${{needs.AsteriskUnitTestMatrix.result}}
run: |
case $RESULT in
success)
echo "::notice::All tests passed"
exit 0
;;
skipped)
echo "::notice::Unit tests were skipped because of an earlier failure"
exit 1
;;
*)
echo "::error::One or more tests failed ($RESULT)"
exit 1
esac
AsteriskGateTestMatrix:
needs: [ IdentifyBranches, AsteriskUnitTests ]
if: ${{ success() }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.IdentifyBranches.outputs.branches) }}
group: ${{ fromJSON(vars.GATETEST_LIST) }}
runs-on: ubuntu-latest
steps:
- name: Run Gate Tests for ${{ matrix.group }}-${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
with:
test_type: Gate
asterisk_repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.branch}}
is_cherry_pick: true
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:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: AsteriskGateTestMatrix
steps:
- name: Check test matrix status
env:
RESULT: ${{needs.AsteriskGateTestMatrix.result}}
run: |
case $RESULT in
success)
echo "::notice::All Testsuite tests passed"
exit 0
;;
skipped)
echo "::error::Testsuite tests were skipped because of an earlier failure"
exit 1
;;
*)
echo "::error::One or more Testsuite tests failed ($RESULT)"
exit 1
esac

47
.github/workflows/NightlyAdmin.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Nightly Admin
on:
schedule:
- cron: '30 1 * * *'
env:
ASTERISK_REPO: ${{ github.repository }}
PR_NUMBER: 0
PR_COMMIT: ''
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
jobs:
CloseStaleIssues:
runs-on: ubuntu-latest
steps:
- name: Close Stale Issues
uses: actions/stale@v7
with:
stale-issue-message: 'This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
close-issue-message: 'This issue was closed because it has been stalled for 14 days with no activity.'
days-before-stale: 7
days-before-close: 14
days-before-pr-close: -1
only-label: triage,feedback-required
PublishWikiDocs:
if: ${{fromJSON(vars.WIKIDOCS_ENABLE) == true}}
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(vars.WIKIDOC_BRANCHES) }}
runs-on: ubuntu-latest
steps:
- name: PublishWikiDocs
uses: asterisk/asterisk-ci-actions/AsteriskPublishDocsComposite@main
with:
asterisk_repo: ${{env.ASTERISK_REPO}}
base_branch: ${{matrix.branch}}
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
publish_docs_repo: ${{vars.PUBLISH_DOCS_REPO}}
publish_docs_branch: ${{vars.PUBLISH_DOCS_BRANCH}}
confluence_url: ${{vars.CONFLUENCE_URL}}
confluence_userpass: ${{secrets.CONFLUENCE_USERPASS}}
confluence_space: ${{vars.CONFLUENCE_SPACE}}

59
.github/workflows/NightlyTests.yml vendored Normal file
View File

@ -0,0 +1,59 @@
name: NightlyTests
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
env:
ASTERISK_REPO: ${{ github.repository }}
PR_NUMBER: 0
PR_COMMIT: ''
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }}
jobs:
AsteriskNightly:
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(vars.NIGHTLYTEST_BRANCHES) }}
group: ${{ fromJSON(vars.NIGHTLYTEST_LIST) }}
runs-on: ubuntu-latest
steps:
- name: Run Nightly Tests for ${{ matrix.group }}/${{ matrix.branch }}
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
with:
test_type: Nightly
asterisk_repo: ${{env.ASTERISK_REPO}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.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}}
AsteriskNightlyTests:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: AsteriskNightly
steps:
- name: Check test matrix status
env:
RESULT: ${{needs.AsteriskNightly.result}}
run: |
case $RESULT in
success)
echo "::notice::All Testsuite tests passed"
exit 0
;;
skipped)
echo "::error::Testsuite tests were skipped because of an earlier failure"
exit 1
;;
*)
echo "::error::One or more Testsuite tests failed"
exit 1
esac

69
.github/workflows/PRMerged.yml vendored Normal file
View File

@ -0,0 +1,69 @@
name: PRMerged
run-name: "PR ${{github.event.number || inputs.pr_number}} ${{github.event.action || 'MANUAL POST MERGE'}} by ${{ github.actor }}"
on:
pull_request_target:
types: [closed]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number'
required: true
type: number
concurrency:
group: ${{github.workflow}}-${{github.event.number || inputs.pr_number}}
cancel-in-progress: true
env:
REPO: ${{github.repository}}
PR_NUMBER: ${{github.event.number || inputs.pr_number}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
CloseIssues:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: wow-actions/auto-close-fixed-issues@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IdentifyBranches:
if: github.event.pull_request.merged == true || inputs.pr_number
outputs:
branches: ${{ steps.getbranches.outputs.branches }}
branch_count: ${{ steps.getbranches.outputs.branch_count }}
github_token: ${{steps.get_workflow_token.outputs.token}}
runs-on: ubuntu-latest
steps:
- name: Get cherry-pick branches
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
id: getbranches
with:
repo: ${{env.REPO}}
pr_number: ${{env.PR_NUMBER}}
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
github_token: ${{env.GITHUB_TOKEN}}
MergeCherryPicks:
needs: [ IdentifyBranches ]
if: needs.IdentifyBranches.outputs.branch_count > 0
continue-on-error: false
strategy:
fail-fast: true
matrix:
branch: ${{ fromJSON(needs.IdentifyBranches.outputs.branches) }}
runs-on: ubuntu-latest
steps:
- name: Cherry Pick PR ${{env.PR_NUMBER}} to branch ${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/CherryPick@main
with:
repo: ${{env.REPO}}
pr_number: ${{env.PR_NUMBER}}
branch: ${{matrix.branch}}
github_token: ${{secrets.ASTERISKTEAM_PAT}}
access_app_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
access_app_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}

104
.github/workflows/PROpenedOrUpdated.yml vendored Normal file
View File

@ -0,0 +1,104 @@
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: 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
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
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 }}
run: |
echo "all results: ${{ toJSON(needs.*.result) }}"
echo "composite result: ${{ needs.AsteriskGate.result }}"
case $RESULT in
success)
echo "::notice::All Testsuite tests passed"
exit 0
;;
skipped)
echo "::error::Testsuite tests were skipped because of an earlier failure"
exit 1
;;
*)
echo "::error::One or more Testsuite tests failed ($RESULT)"
exit 1
esac