From: George Joseph Date: Wed, 5 Jul 2023 14:02:57 +0000 (-0600) Subject: .github: Add workflow to this branch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eef68819b7e3f13c3ea52e2d4c45d9ebf50a0af1;p=thirdparty%2Fasterisk.git .github: Add workflow to this branch --- diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000000..c0d42ab571 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,87 @@ +name: Bug +description: File a bug report +title: "[bug]: " +labels: ["bug", "triage"] +#assignees: +# - octocat +body: + - type: markdown + attributes: + value: | + Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed. + + A good first step is for you to review the Asterisk Issue Guidelines if you haven't already. The guidelines detail what is expected from an Asterisk issue report. + + Then, if you are submitting a patch, please review the Patch Contribution Process. + + Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur. + + Please note that by submitting data, code, or documentation to Sangoma through GitHub, you accept the Terms of Use present at + https://www.asterisk.org/terms-of-use/. + Thanks for taking the time to fill out this bug report! + - type: dropdown + id: severity + attributes: + label: Severity + options: + - Trivial + - Minor + - Major + - Critical + - Blocker + validations: + required: true + - type: input + id: versions + attributes: + label: Versions + description: Enter one or more versions separated by commas. + validations: + required: true + - type: input + id: components + attributes: + label: Components/Modules + description: Enter one or more components or modules separated by commas. + validations: + required: true + - type: textarea + id: environment + attributes: + label: Operating Environment + description: OS, Disribution, Version, etc. + validations: + required: true + - type: dropdown + id: frequency + attributes: + label: Frequency of Occurrence + options: + - "Never" + - "One Time" + - "Occasional" + - "Frequent" + - "Constant" + - type: textarea + id: description + attributes: + label: Issue Description + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: markdown + attributes: + value: | + [Asterisk Issue Guidelines](https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines) + - type: checkboxes + id: guidelines + attributes: + label: Asterisk Issue Guidelines + options: + - label: Yes, I have read the Asterisk Issue Guidelines + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..5aa5d2e7e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Asterisk Community Support + url: https://community.asterisk.org + about: Please ask and answer questions here. + - name: Feature Requests + url: https://github.com/asterisk/asterisk-feature-requests/issues + about: Please submit feature requests here. diff --git a/.github/ISSUE_TEMPLATE/improvement.yml b/.github/ISSUE_TEMPLATE/improvement.yml new file mode 100644 index 0000000000..64d2634653 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/improvement.yml @@ -0,0 +1,27 @@ +name: Improvement +description: Submit an improvement to existing functionality +title: "[improvement]: " +labels: ["improvement", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed. + + A good first step is for you to review the Asterisk Issue Guidelines if you haven't already. The guidelines detail what is expected from an Asterisk issue report. + + Then, if you are submitting a patch, please review the Patch Contribution Process. + + Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur. + + Please note that by submitting data, code, or documentation to Sangoma through GitHub, you accept the Terms of Use present at + https://www.asterisk.org/terms-of-use/. + Thanks for taking the time to fill out this bug report! + - type: textarea + id: description + attributes: + label: Improvement Description + description: Describe the improvement in as much detail as possible + validations: + required: true + diff --git a/.github/ISSUE_TEMPLATE/new-feature.yml b/.github/ISSUE_TEMPLATE/new-feature.yml new file mode 100644 index 0000000000..8214f86915 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-feature.yml @@ -0,0 +1,27 @@ +name: New Feature Submission +description: Submit a New Feature +title: "[new-feature]: " +labels: ["new-feature", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed. + + A good first step is for you to review the Asterisk Issue Guidelines if you haven't already. The guidelines detail what is expected from an Asterisk issue report. + + Then, if you are submitting a patch, please review the Patch Contribution Process. + + Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur. + + Please note that by submitting data, code, or documentation to Sangoma through GitHub, you accept the Terms of Use present at + https://www.asterisk.org/terms-of-use/. + Thanks for taking the time to fill out this bug report! + - type: textarea + id: description + attributes: + label: Feature Description + description: Describe the new feature in as much detail as possible + validations: + required: true + diff --git a/.github/workflows/AsteriskReleaser.yml b/.github/workflows/AsteriskReleaser.yml new file mode 100644 index 0000000000..15afe9cbca --- /dev/null +++ b/.github/workflows/AsteriskReleaser.yml @@ -0,0 +1,82 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: Asterisk Release +run-name: ${{ github.actor }} is creating Asterisk release ${{inputs.new_version}} +on: + workflow_dispatch: + inputs: + is_security: + description: | + Security or Hotfix? + required: true + type: boolean + default: false + new_version: + description: | + New Version: + Examples: + 20.4.0-rc1, 20.4.0-rc2, 20.4.0, 20.4.1 + certified-20.4-cert1-rc1, certified-20.4-cert1 + required: true + type: string + start_version: + description: | + Last Version: + Only use when you KNOW that the automated + process won't get it right. + required: false + type: string + push_release_branches: + description: | + Push release branches live? + required: true + type: boolean + default: false + create_github_release: + description: | + Create the GitHub release? + required: true + type: boolean + default: false + push_tarballs: + description: | + Push tarballs to downloads server? + required: true + type: boolean + default: false + send_email: + description: | + Send announcement emails? + required: true + type: boolean + default: false + +jobs: + ReleaseAsterisk: + runs-on: ubuntu-latest + steps: + - name: Run Releaser + uses: asterisk/asterisk-ci-actions/AsteriskReleaserComposite@main + with: + is_security: ${{inputs.is_security}} + new_version: ${{inputs.new_version}} + start_version: ${{inputs.start_version}} + push_release_branches: ${{inputs.push_release_branches}} + create_github_release: ${{inputs.create_github_release}} + push_tarballs: ${{inputs.push_tarballs}} + send_email: ${{inputs.send_email}} + repo: ${{github.repository}} + asterisk_mail_list_ga: ${{vars.ASTERISK_MAIL_LIST_GA}} + asterisk_mail_list_rc: ${{vars.ASTERISK_MAIL_LIST_RC}} + asterisk_mail_list_cert_ga: ${{vars.ASTERISK_MAIL_LIST_CERT_GA}} + asterisk_mail_list_cert_rc: ${{vars.ASTERISK_MAIL_LIST_CERT_RC}} + asterisk_mail_list_sec: ${{vars.ASTERISK_MAIL_LIST_CERT_SEC}} + gpg_private_key: ${{secrets.ASTDEV_GPG_PRIV_KEY}} + github_token: ${{secrets.GITHUB_TOKEN}} + application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}} + application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}} + asteriskteamsa_username: ${{secrets.ASTERISKTEAMSA_GMAIL_ACCT}} + asteriskteamsa_token: ${{secrets.ASTERISKTEAMSA_GMAIL_TOKEN}} + deploy_ssh_priv_key: ${{secrets.ASTERISK_DEPLOY_SSH_PRIV_KEY}} + deploy_ssh_username: ${{secrets.ASTERISK_DEPLOY_SSH_USERNAME}} + deploy_host: ${{vars.ASTERISK_DEPLOY_HOST}} + deploy_dir: ${{vars.ASTERISK_DEPLOY_DIR}} diff --git a/.github/workflows/CherryPickTest.yml b/.github/workflows/CherryPickTest.yml new file mode 100644 index 0000000000..ffdf71ec9a --- /dev/null +++ b/.github/workflows/CherryPickTest.yml @@ -0,0 +1,167 @@ +name: CherryPickTest +run-name: "Cherry-Pick Tests for PR ${{github.event.number}}" +on: + pull_request_target: + types: [ labeled ] + +concurrency: + group: ${{github.workflow}}-${{github.event.number}} + cancel-in-progress: true + +env: + PR_NUMBER: ${{ github.event.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, Add InProgress Label + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.CHERRY_PICK_TEST_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}} \ + --remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \ + ${{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_regex: ${{vars.CHERRY_PICK_REGEX}} + github_token: ${{secrets.GITHUB_TOKEN}} + + - name: Check Branch Count + if: ${{ steps.getbranches.outputs.branch_count > 0 }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \ + ${{env.PR_NUMBER}} || : + + CherryPickUnitTestMatrix: + needs: [ IdentifyBranches ] + if: ${{ needs.IdentifyBranches.outputs.branch_count > 0 && ( success() || failure() ) }} + 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}} + + CherryPickUnitTests: + needs: [ IdentifyBranches, CherryPickUnitTestMatrix ] + if: ${{ needs.IdentifyBranches.outputs.branch_count > 0 && ( success() || failure() ) }} + runs-on: ubuntu-latest + steps: + - name: Check unit test matrix status + env: + RESULT: ${{needs.CherryPickUnitTestMatrix.result}} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + case $RESULT in + success) + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.CHERRY_PICK_CHECKS_PASSED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::notice::All tests passed" + exit 0 + ;; + skipped) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \ + --add-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::notice::Unit tests were skipped because of an earlier failure" + exit 1 + ;; + *) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \ + --add-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::error::One or more tests failed ($RESULT)" + exit 1 + esac + + CherryPickGateTestMatrix: + needs: [ IdentifyBranches, CherryPickUnitTests ] + 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}} + + CherryPickGateTests: + needs: [ IdentifyBranches, CherryPickGateTestMatrix ] + if: ${{ success() || failure() }} + runs-on: ubuntu-latest + steps: + - name: Check test matrix status + env: + RESULT: ${{needs.CherryPickGateTestMatrix.result}} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \ + ${{env.PR_NUMBER}} || : + case $RESULT in + success) + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::notice::All Testsuite tests passed" + exit 0 + ;; + skipped) + echo "::error::Testsuite tests were skipped because of an earlier failure" + exit 1 + ;; + *) + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::error::One or more Testsuite tests failed ($RESULT)" + exit 1 + esac diff --git a/.github/workflows/CreateDocs.yml b/.github/workflows/CreateDocs.yml new file mode 100644 index 0000000000..1882500b24 --- /dev/null +++ b/.github/workflows/CreateDocs.yml @@ -0,0 +1,109 @@ +name: CreateDocs +on: + workflow_dispatch: + inputs: + branches: + description: "JSON array of branches: ['18','20'] (no spaces)" + required: true + type: string + schedule: +# Times are UTC + - cron: '0 04 * * *' + +env: + ASTERISK_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + CreateDocsDebug: + runs-on: ubuntu-latest + steps: + - name: DumpEnvironment + uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main + with: + action-vars: ${{toJSON(inputs)}} + + CreateDocsScheduledMatrix: + needs: [ CreateDocsDebug ] + if: ${{github.event_name == 'schedule' && fromJSON(vars.WIKIDOCS_ENABLE) == true }} + continue-on-error: false + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(vars.WIKIDOC_BRANCHES) }} + runs-on: ubuntu-latest + steps: + - name: CreateDocs for ${{matrix.branch}} + uses: asterisk/asterisk-ci-actions/CreateAsteriskDocsComposite@main + with: + asterisk_repo: ${{env.ASTERISK_REPO}} + base_branch: ${{matrix.branch}} + docs_dir: docs_dir/${{matrix.branch}} + github_token: ${{secrets.GITHUB_TOKEN}} + + CreateDocsScheduled: + needs: [ CreateDocsScheduledMatrix ] + if: ${{ success() || failure() }} + runs-on: ubuntu-latest + steps: + - name: Check CreateDocsScheduledMatrix status + env: + RESULT: ${{needs.CreateDocsScheduledMatrix.result}} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + case $RESULT in + success) + echo "::notice::Docs created" + exit 0 + ;; + skipped) + echo "::notice::Skipped" + exit 1 + ;; + *) + echo "::error::One or CreateDocs failed ($RESULT)" + exit 1 + esac + + CreateDocsManualMatrix: + needs: [ CreateDocsDebug ] + if: ${{github.event_name == 'workflow_dispatch'}} + continue-on-error: false + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(inputs.branches) }} + runs-on: ubuntu-latest + steps: + - name: CreateDocs for ${{matrix.branch}} + uses: asterisk/asterisk-ci-actions/CreateAsteriskDocsComposite@main + with: + asterisk_repo: ${{env.ASTERISK_REPO}} + base_branch: ${{matrix.branch}} + docs_dir: docs_dir/${{matrix.branch}} + github_token: ${{secrets.GITHUB_TOKEN}} + + CreateDocsManual: + needs: [ CreateDocsManualMatrix ] + if: ${{ success() || failure() }} + runs-on: ubuntu-latest + steps: + - name: Check CreateDocsManualMatrix status + env: + RESULT: ${{needs.CreateDocsManualMatrix.result}} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + case $RESULT in + success) + echo "::notice::Docs created" + exit 0 + ;; + skipped) + echo "::notice::Skipped" + exit 1 + ;; + *) + echo "::error::One or CreateDocs failed ($RESULT)" + exit 1 + esac diff --git a/.github/workflows/IssueOpened.yml b/.github/workflows/IssueOpened.yml new file mode 100644 index 0000000000..74cef00b4d --- /dev/null +++ b/.github/workflows/IssueOpened.yml @@ -0,0 +1,15 @@ +name: Issue Opened +run-name: "Issue ${{github.event.number}} ${{github.event.action}} by ${{github.actor}}" +on: + issues: + types: opened + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - name: initial labeling + uses: andymckay/labeler@master + with: + add-labels: "triage" + ignore-if-labeled: true diff --git a/.github/workflows/MergeApproved.yml b/.github/workflows/MergeApproved.yml new file mode 100644 index 0000000000..344c45b1bb --- /dev/null +++ b/.github/workflows/MergeApproved.yml @@ -0,0 +1,190 @@ +name: MergeApproved +run-name: "Merge Approved for PR ${{github.event.number}}" +on: + pull_request_target: + types: [labeled] + +env: + PR_NUMBER: ${{ github.event.number }} + BASE_BRANCH: ${{github.event.pull_request.base.ref}} + MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }} + FORCE: ${{ endsWith(github.event.label.name, '-force') }} + +jobs: + IdentifyBranches: + if: contains(fromJSON(vars.MERGE_APPROVED_LABELS), github.event.label.name) + outputs: + branches: ${{ steps.getbranches.outputs.branches }} + all_branches: ${{ steps.checkbranches.outputs.all_branches }} + branch_count: ${{ steps.getbranches.outputs.branch_count }} + runs-on: ubuntu-latest + steps: + - name: Clean up labels + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{github.event.label.name}} \ + --remove-label ${{vars.PRE_MERGE_CHECKS_PASSED_LABEL}} \ + --remove-label ${{vars.PRE_MERGE_CHECKS_FAILED_LABEL}} \ + --remove-label ${{vars.PRE_MERGE_GATES_PASSED_LABEL}} \ + --remove-label ${{vars.PRE_MERGE_GATES_FAILED_LABEL}} \ + --remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \ + ${{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_regex: ${{vars.CHERRY_PICK_REGEX}} + github_token: ${{secrets.GITHUB_TOKEN}} + + - name: Check Branch Count + id: checkbranches + env: + BRANCH_COUNT: ${{ steps.getbranches.outputs.branch_count }} + BRANCHES: ${{ steps.getbranches.outputs.branches }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \ + ${{env.PR_NUMBER}} || : + all_branches=$(echo "$BRANCHES" | jq -c "[ \"$BASE_BRANCH\" ] + .") + echo "all_branches=${all_branches}" >>${GITHUB_OUTPUT} + + - name: Pre Check Cherry-Picks + if: ${{ steps.getbranches.outputs.branch_count > 0 }} + uses: asterisk/asterisk-ci-actions/CherryPick@main + with: + repo: ${{github.repository}} + pr_number: ${{env.PR_NUMBER}} + branches: ${{steps.getbranches.outputs.branches}} + github_token: ${{secrets.GITHUB_TOKEN}} + push: false + + PreMergeUnitTestMatrix: + needs: [ IdentifyBranches ] + if: success() + continue-on-error: false + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(needs.IdentifyBranches.outputs.all_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}} + + PreMergeUnitTests: + needs: [ IdentifyBranches, PreMergeUnitTestMatrix ] + runs-on: ubuntu-latest + steps: + - name: Check unit test matrix status + env: + RESULT: ${{needs.PreMergeUnitTestMatrix.result}} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + case $RESULT in + success) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \ + --add-label ${{vars.PRE_MERGE_CHECKS_PASSED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::notice::All tests passed" + exit 0 + ;; + skipped) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \ + --add-label ${{vars.PRE_MERGE_CHECKS_FAILED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::notice::Unit tests were skipped because of an earlier failure" + exit 1 + ;; + *) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \ + --add-label ${{vars.PRE_MERGE_CHECKS_FAILED_LABEL}} \ + ${{env.PR_NUMBER}} || : + echo "::error::One or more tests failed ($RESULT)" + exit 1 + esac + + MergeAndCherryPick: + needs: [ IdentifyBranches, PreMergeUnitTests ] + if: success() + concurrency: + group: MergeAndCherryPick + cancel-in-progress: false + runs-on: ubuntu-latest + steps: + - name: Start Merge + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.MERGE_IN_PROGRESS_LABEL}} \ + ${{env.PR_NUMBER}} || : + + - name: Get Token needed to push cherry-picks + 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: Merge and Cherry Pick to ${{needs.IdentifyBranches.outputs.branches}} + id: mergecp + uses: asterisk/asterisk-ci-actions/MergeAndCherryPickComposite@main + with: + repo: ${{github.repository}} + pr_number: ${{env.PR_NUMBER}} + branches: ${{needs.IdentifyBranches.outputs.branches}} + force: ${{env.FORCE}} + github_token: ${{steps.get_workflow_token.outputs.token}} + + - name: Merge Cleanup + if: always() + env: + RESULT: ${{ steps.mergecp.outcome }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH_COUNT: ${{ needs.IdentifyBranches.outputs.branch_count }} + BRANCHES: ${{ needs.IdentifyBranches.outputs.branches }} + + run: | + case $RESULT in + success) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.MERGE_IN_PROGRESS_LABEL}} \ + ${{env.PR_NUMBER}} || : + if [ $BRANCH_COUNT -eq 0 ] ; then + gh pr comment --repo ${{github.repository}} \ + -b "Successfully merged to branch $BASE_BRANCH." \ + ${{env.PR_NUMBER}} || : + else + gh pr comment --repo ${{github.repository}} \ + -b "Successfully merged to branch $BASE_BRANCH and cherry-picked to $BRANCHES" \ + ${{env.PR_NUMBER}} || : + fi + exit 0 + ;; + failure) + gh pr edit --repo ${{github.repository}} \ + --remove-label ${{vars.MERGE_IN_PROGRESS_LABEL}} \ + --add-label ${{vars.MERGE_FAILED_LABEL}} \ + ${{env.PR_NUMBER}} || : + exit 1 + ;; + *) + esac diff --git a/.github/workflows/NightlyAdmin.yml b/.github/workflows/NightlyAdmin.yml new file mode 100644 index 0000000000..f190671ee8 --- /dev/null +++ b/.github/workflows/NightlyAdmin.yml @@ -0,0 +1,28 @@ +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.' + stale-issue-label: stale + 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-labels: triage,feedback-required + diff --git a/.github/workflows/NightlyTests.yml b/.github/workflows/NightlyTests.yml new file mode 100644 index 0000000000..7eb3e163b7 --- /dev/null +++ b/.github/workflows/NightlyTests.yml @@ -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 diff --git a/.github/workflows/PRMerged.yml b/.github/workflows/PRMerged.yml new file mode 100644 index 0000000000..774736a3bf --- /dev/null +++ b/.github/workflows/PRMerged.yml @@ -0,0 +1,32 @@ +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 }} + diff --git a/.github/workflows/PROpenedOrUpdated.yml b/.github/workflows/PROpenedOrUpdated.yml new file mode 100644 index 0000000000..e75766a791 --- /dev/null +++ b/.github/workflows/PROpenedOrUpdated.yml @@ -0,0 +1,154 @@ +name: PROpenedOrUpdated +run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}" +on: +# workflow_dispatch: + pull_request_target: + types: [opened, reopened, synchronize] + +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: + + PROpenUpdateUnitTests: + runs-on: ubuntu-latest + steps: + - name: Get Token needed to add reviewers + if: github.event.action == 'opened' + 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 cherry-pick reminder and reviewers + if: github.event.action == 'opened' + env: + GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}} + GH_TOKEN: ${{steps.get_workflow_token.outputs.token}} + CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}} + REVIEWERS: ${{vars.PR_REVIEWERS}} + run: | + IFS=$'; \n' + for r in $REVIEWERS ; do + echo "Adding reviewer $r" + gh pr edit --repo ${{github.repository}} ${PR_NUMBER} --add-reviewer $r || : + done + # If there's already a reminder comment, don't add another one. + ADD_COMMENT=true + # This query will FAIL if it finds the comment. + gh pr view --repo ${{github.repository}} --json comments \ + --jq '.comments[].body | select(. | startswith("")) | halt_error(1)' \ + ${{env.PR_NUMBER}} >/dev/null 2>&1 || ADD_COMMENT=false + if $ADD_COMMENT ; then + echo "Adding CPR comment" + gh pr comment --repo ${{github.repository}} \ + -b "${CHERRY_PICK_REMINDER}" ${{env.PR_NUMBER}} + else + echo "CPR comment already present" + fi + + - 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: Add Checks Passed Label + if: ${{ success() }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit --repo ${{github.repository}} \ + --add-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \ + ${{env.PR_NUMBER}} || : + + PROpenUpdateGateTestMatrix: + needs: PROpenUpdateUnitTests + 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}} + + + PROpenUpdateGateTests: + if: always() + runs-on: ubuntu-latest + needs: PROpenUpdateGateTestMatrix + steps: + - name: Check test matrix status + env: + RESULT: ${{ needs.PROpenUpdateGateTestMatrix.result }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "all results: ${{ toJSON(needs.*.result) }}" + echo "composite result: $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