From f8c3da8e93ce9fe1876b66e096dcb7e2b584a253 Mon Sep 17 00:00:00 2001 From: abose Date: Sat, 4 Nov 2023 18:33:57 +0530 Subject: [PATCH] ci: staging and prod test runs on pull request instead of push --- .../workflows/prod-desktop-tests-on-push.yml | 44 +------------------ .../staging-desktop-tests-on-push.yml | 44 +------------------ 2 files changed, 4 insertions(+), 84 deletions(-) diff --git a/.github/workflows/prod-desktop-tests-on-push.yml b/.github/workflows/prod-desktop-tests-on-push.yml index 5ad4247b..3a87be2d 100644 --- a/.github/workflows/prod-desktop-tests-on-push.yml +++ b/.github/workflows/prod-desktop-tests-on-push.yml @@ -1,13 +1,9 @@ -name: On-Push prod Win/Mac/Linux run full tests suite +name: On pull request on prod Win/Mac/Linux run full tests suite on: - push: + pull_request: branches: [ prod ] -permissions: - contents: read - issues: write - jobs: testDesktopLinux: @@ -223,39 +219,3 @@ jobs: echo "Windows tests failed, marking step as failed" exit 1 shell: cmd - - raiseIssue: - needs: [ testDesktopLinux, testDesktopMac, testDesktopWindows] - runs-on: ubuntu-latest - if: | - always() && ( # This ensures that this job runs even if the previous jobs failed - needs.testDesktopLinux.result == 'failure' || - needs.testDesktopMac.result == 'failure' || - needs.testDesktopWindows.result == 'failure' - ) - steps: - - name: Check for failures and raise an issue - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const issueTitle = "Test failure on push to prod branch: commit ${{github.sha}}"; - const runURL = `https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}`; - let issueBody = `There was a test failure. Please investigate.\n\n[Check the failed run here](${runURL})\n\n`; - - if (needs.testDesktopLinux.result == 'failure') { - issueBody += " - Desktop Linux tests failed.\n"; - } - if (needs.testDesktopMac.result == 'failure') { - issueBody += " - Desktop MacOS tests failed.\n"; - } - if (needs.testDesktopWindows.result == 'failure') { - issueBody += " - Desktop Windows tests failed.\n"; - } - - github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: issueTitle, - body: issueBody - }); diff --git a/.github/workflows/staging-desktop-tests-on-push.yml b/.github/workflows/staging-desktop-tests-on-push.yml index 9bd9a2bc..854aa3d0 100644 --- a/.github/workflows/staging-desktop-tests-on-push.yml +++ b/.github/workflows/staging-desktop-tests-on-push.yml @@ -1,13 +1,9 @@ -name: On-Push staging Win/Mac/Linux run full tests suite +name: On pull request on staging Win/Mac/Linux run full tests suite on: - push: + pull_request: branches: [ staging ] -permissions: - contents: read - issues: write - jobs: testDesktopLinux: @@ -223,39 +219,3 @@ jobs: echo "Windows tests failed, marking step as failed" exit 1 shell: cmd - - raiseIssue: - needs: [ testDesktopLinux, testDesktopMac, testDesktopWindows] - runs-on: ubuntu-latest - if: | - always() && ( # This ensures that this job runs even if the previous jobs failed - needs.testDesktopLinux.result == 'failure' || - needs.testDesktopMac.result == 'failure' || - needs.testDesktopWindows.result == 'failure' - ) - steps: - - name: Check for failures and raise an issue - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const issueTitle = "Test failure on push to staging branch: commit ${{github.sha}}"; - const runURL = `https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}`; - let issueBody = `There was a test failure. Please investigate.\n\n[Check the failed run here](${runURL})\n\n`; - - if (needs.testDesktopLinux.result == 'failure') { - issueBody += " - Desktop Linux tests failed.\n"; - } - if (needs.testDesktopMac.result == 'failure') { - issueBody += " - Desktop MacOS tests failed.\n"; - } - if (needs.testDesktopWindows.result == 'failure') { - issueBody += " - Desktop Windows tests failed.\n"; - } - - github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: issueTitle, - body: issueBody - });