From 5f21b485f454d684a1f3ed95744b300f236a3007 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 20 Dec 2023 15:12:49 -0600 Subject: [PATCH] ci: rely on the `workflow_run` for check creation --- .github/workflows/integration.yml | 51 +++-------------------------- .github/workflows/mergify-ready.yml | 22 ------------- 2 files changed, 5 insertions(+), 68 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 6802095..18ff860 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -37,11 +37,6 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v3 - - name: Recreate integration-test-result if needed - id: get-pending-integration-result - uses: ./.github/actions/get-latest-check - with: - create-if-needed: true - name: Get the behavior from the PR description id: get-behavior uses: actions/github-script@v6 @@ -83,11 +78,6 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v3 - - name: Recreate integration-test-result if needed - id: get-pending-integration-result - uses: ./.github/actions/get-latest-check - with: - create-if-needed: true - name: Get the behavior from the PR description id: get-behavior uses: actions/github-script@v6 @@ -115,29 +105,6 @@ jobs: sleep ${{ fromJSON(steps.get-behavior.outputs.result).sleep || 45 }} exit ${{ fromJSON(steps.get-behavior.outputs.result).exitCode || 0 }} - set-integration-result-in-progress: - needs: pre_check - if: needs.pre_check.outputs.should_run == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - id: get-pending-integration-result - uses: ./.github/actions/get-latest-check - with: - create-if-needed: true - - name: Update integration-test-result check to in-progress - uses: actions/github-script@v6 - with: - script: | - const runId = "${{ steps.get-pending-integration-result.outputs.run_id }}"; - const res = await github.rest.checks.update({ - ...context.repo, - check_run_id: runId, - status: "in_progress", - }) - core.debug(`Check update response: ${JSON.stringify(res, null, 2)}`) - console.log(`Updated check ${runId} to in-progress`) - finalize-integration-result: needs: - pre_check @@ -155,25 +122,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - id: get-pending-integration-result - uses: ./.github/actions/get-latest-check - with: - create-if-needed: true - - name: Publish integration-test-result + - name: Final integration test result if: always() uses: actions/github-script@v6 with: script: | - const runId = "${{ steps.get-pending-integration-result.outputs.run_id }}"; const previousSuccess = ${{ needs.pre_check.outputs.previous_success }}; const matrixTestSuccess = "${{ needs.matrix-test.result }}" === "success"; const standaloneTestSuccess = "${{ needs.standalone-test.result }}" === "success"; const conclusion = previousSuccess || (matrixTestSuccess && standaloneTestSuccess) ? 'success' : 'failure'; - const res = await github.rest.checks.update({ - ...context.repo, - check_run_id: runId, - conclusion, - }) - core.debug(`Check update response: ${JSON.stringify(res, null, 2)}`) - console.log(`Updated check ${runId} to ${conclusion}`) + console.log(`Finishing with ${conclusion}`) + if (conclusion === 'failure') { + core.setFailed('Integration tests failed') + } diff --git a/.github/workflows/mergify-ready.yml b/.github/workflows/mergify-ready.yml index b406049..228bcb8 100644 --- a/.github/workflows/mergify-ready.yml +++ b/.github/workflows/mergify-ready.yml @@ -15,28 +15,6 @@ on: merge_group: jobs: - wait-integration-pre-checks: - runs-on: ubuntu-latest - steps: - - name: Create integration-test-result check - id: create-check - if: always() - uses: actions/github-script@v6 - with: - script: | - const head_sha = context.eventName === 'pull_request' ? - context.payload.pull_request.head.sha : context.sha - const res = await github.rest.checks.create({ - ...context.repo, - head_sha, - name: "integration-test-result", - }) - core.debug('check create response: ${JSON.stringify(res, null, 2)}') - console.log('created integration-test-result', res.data.html_url) - return res.data.id - outputs: - run_id: ${{ steps.create-check.outputs.result }} - merge-strategy: runs-on: ubuntu-latest if: >-