Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: rely on the workflow_run for check creation #5

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 5 additions & 46 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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')
}
22 changes: 0 additions & 22 deletions .github/workflows/mergify-ready.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down