From 5aba5bdec4fdd1666873cb4082e343dd9630f2b5 Mon Sep 17 00:00:00 2001 From: Matthew Sakai Date: Tue, 16 Jul 2024 20:49:11 -0400 Subject: [PATCH] Restore CI workflow files Rebasing can destory these, so recreate them if necessary. Signed-off-by: Matthew Sakai --- .github/workflows/ci.yml | 97 +++++++++++++++++++++++++++++++++++ .github/workflows/notify.yml | 98 ++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/notify.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000000..765bf1753d1f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +name: CI + +on: + pull_request_target: + types: [ opened, reopened, ready_for_review, synchronize ] + workflow_dispatch: + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + Verifying: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - name: Start verification + run: echo Verification Start + + # Run assignment action + - name: Assign reviewers and assignees + uses: dm-vdo/vdo-auto-assign@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Remove all known labels + uses: buildsville/add-remove-label@v2.0.0 + with: + token: ${{secrets.GITHUB_TOKEN}} + labels: untested, private testing running, private testing done, private testing failed + type: remove + + - name: Add untested label + uses: buildsville/add-remove-label@v2.0.0 + with: + token: ${{secrets.VDODEVEL}} + label: untested + type: add + + Testing: + if: github.event.pull_request.draft == false + runs-on: [self-hosted, trusted] + needs: [Verifying] + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + path: dm-linux + + - uses: actions/checkout@v2 + with: + repository: ${{ github.event.repository.owner.login }}/vdo-devel + path: vdo-devel + + - name: Add private testing running label + uses: buildsville/add-remove-label@v2.0.0 + with: + token: ${{secrets.GITHUB_TOKEN}} + label: private testing running + type: add + + - name: Start private testing + run: | + cd ${{ github.workspace }}/vdo-devel/src/ + make DMLINUX_SOURCE_DIR=${{ github.workspace }}/dm-linux dmlinux-jenkins + + - name: Copy log file to /permatbit/user/bunsen/artifacts + if: failure() + run: | + REPO=${{ github.repository }} + REPO=${REPO//\//-} + cp -a ${{ github.workspace }}/vdo-devel/logs /permabit/user/bunsen/artifacts/logs.`date +'%Y%m%d%H%M'`.$REPO.${{ github.event.number }} + + - name: Remove private testing running label + if: always() + uses: buildsville/add-remove-label@v2.0.0 + with: + token: ${{secrets.GITHUB_TOKEN}} + label: private testing running + type: remove + + - name: Add private testing failed + if: failure() + uses: buildsville/add-remove-label@v2.0.0 + with: + token: ${{secrets.GITHUB_TOKEN}} + label: private testing failed + type: add + + - name: Add private testing success + if: success() + uses: buildsville/add-remove-label@v2.0.0 + with: + token: ${{secrets.VDODEVEL}} + label: private testing done + type: add diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml new file mode 100644 index 000000000000..ec624d2e8174 --- /dev/null +++ b/.github/workflows/notify.yml @@ -0,0 +1,98 @@ +name: Notify + +on: + schedule: + - cron: '0 0,2,10,12,14,16,18,20,22 * * 1-5' + workflow_dispatch: + +jobs: + notify_schedule: + env: + ORG: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} + runs-on: ubuntu-latest + steps: + - name: Notify PRs Needing Review + uses: octokit/graphql-action@v2.x + id: prs_need_review + with: + query: | + query needreview($queryString:String!) { + search(type: ISSUE, query: $queryString, last: 100) { + issueCount + } + } + variables: | + queryString: "repo:${{ env.ORG }}/${{env.REPO}}, state:open, is:pr, -label:\"on hold\", review:required," + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: slackapi/slack-github-action@v1.24.0 + if: ${{ env.COUNT > 0 }} + with: + # This data can be any valid JSON from a previous step in the GitHub Action + payload: | + { + "PR_MSG": "Number of PRs awaiting reviews in ${{env.REPO}} : ${{ env.COUNT }}", + "PR_LINK": "https://github.com/${{env.ORG}}/${{env.REPO}}/pulls?q=is%3Apr+is%3Aopen+-label%3A%22on%20hold%22+review%3Arequired" + } + env: + COUNT: ${{ fromJSON(steps.prs_need_review.outputs.data).search.issueCount }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACKMSG }} + + - name: Notify PRs With Feedback + uses: octokit/graphql-action@v2.x + id: prs_with_feedback + with: + query: | + query withfeedback($queryString:String!) { + search(type: ISSUE, query: $queryString, last: 100) { + issueCount + } + } + variables: | + queryString: "repo:${{env.ORG}}/${{env.REPO}}, state:open, is:pr, -label:\"on hold\", review:changes_requested," + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: slackapi/slack-github-action@v1.24.0 + if: ${{ env.COUNT > 0 }} + with: + # This data can be any valid JSON from a previous step in the GitHub Action + payload: | + { + "PR_MSG": "Number of PRs awaiting replies to reviews ${{env.REPO}} : ${{ env.COUNT }}", + "PR_LINK": "https://github.com/${{env.ORG}}/${{env.REPO}}/pulls?q=is%3Apr+is%3Aopen+-label%3A%22on%20hold%22+review%3Achanges_requested" + } + env: + COUNT: ${{ fromJSON(steps.prs_with_feedback.outputs.data).search.issueCount }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACKMSG }} + + + - name: Notify PRs With Approval + uses: octokit/graphql-action@v2.x + id: prs_with_approval + with: + query: | + query withapproval($queryString:String!) { + search(type: ISSUE, query: $queryString, last: 100) { + issueCount + } + } + variables: | + queryString: "repo:${{env.ORG}}/${{env.REPO}}, state:open, is:pr, -label:\"on hold\", review:approved," + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: slackapi/slack-github-action@v1.24.0 + if: ${{ env.COUNT > 0 }} + with: + # This data can be any valid JSON from a previous step in the GitHub Action + payload: | + { + "PR_MSG": "Number of PRs approved in ${{env.REPO}} : ${{ env.COUNT }}", + "PR_LINK": "https://github.com/${{env.ORG}}/${{env.REPO}}/pulls?q=is%3Apr+is%3Aopen+-label%3A%22on%20hold%22+review%3Aapproved" + } + env: + COUNT: ${{ fromJSON(steps.prs_with_approval.outputs.data).search.issueCount }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACKMSG }}