BuildPulse #1794
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: BuildPulse | |
on: | |
workflow_run: | |
workflows: ["Test"] | |
types: | |
- completed | |
workflow_dispatch: | |
inputs: | |
run_id: | |
description: The ID of the Test workflow run | |
required: true | |
run_attempt: | |
description: The attempt number of the Test workflow run | |
required: true | |
event_name: | |
description: The name of the event that triggered the Test workflow run | |
required: true | |
head_branch: | |
description: The name of the head branch that triggered the Test workflow | |
required: true | |
head_commit_id: | |
description: The commit ID of the head commit that triggered the Test workflow run | |
required: true | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
actions: read | |
jobs: | |
buildpulse: | |
name: Upload JUnit XML report to BuildPulse | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure' | |
steps: | |
- name: Check out lotus | |
uses: actions/checkout@v4 | |
with: | |
path: lotus | |
ref: ${{ github.event.inputs.head_commit_id || github.event.workflow_run.head_commit.id }} | |
- name: Check out buildpulse-action | |
uses: actions/checkout@v4 | |
with: | |
repository: buildpulse/buildpulse-action | |
path: buildpulse-action | |
ref: d0d30f53585cf16b2e01811a5a753fd47968654a # v0.11.0 | |
- name: Create a temporary directory to store the JUnit XML reports | |
id: reports | |
run: mktemp -d | xargs -0 -I{} echo "path={}" | tee -a $GITHUB_OUTPUT | |
- name: Download the artifacts so can access the JUnit XML reports from the Test workflow run | |
uses: actions/download-artifact@v4 | |
with: | |
run-id: ${{ github.event.inputs.run_id || github.event.workflow_run.id }} | |
github-token: ${{ github.token }} | |
path: ${{ steps.reports.outputs.path }} | |
- name: Upload test results to BuildPulse for flaky test detection | |
env: | |
INPUT_ACCOUNT: ${{ vars.BUIDPULSE_ACCOUNT_ID }} | |
INPUT_REPOSITORY: ${{ vars.BUILDPULSE_REPOSITORY_ID }} | |
INPUT_PATH: | | |
${{ steps.reports.outputs.path }}/**/*.xml | |
INPUT_KEY: ${{ vars.BUILDPULSE_ACCESS_KEY_ID }} | |
INPUT_SECRET: ${{ secrets.BUILDPULSE_SECRET_ACCESS_KEY }} | |
INPUT_COMMIT: ${{ github.event.inputs.head_commit_id || github.event.workflow_run.head_commit.id }} | |
INPUT_REPOSITORY_PATH: lotus | |
INPUT_RUN_ID: ${{ github.event.inputs.run_id || github.event.workflow_run.id }} | |
INPUT_RUN_ATTEMPT: ${{ github.event.inputs.run_attempt || github.event.workflow_run.run_attempt }} | |
INPUT_EVENT_NAME: ${{ github.event.inputs.event_name || github.event.workflow_run.event }} | |
INPUT_REF: ${{ github.event.inputs.head_branch || github.event.workflow_run.head_branch }} | |
INPUT_HEAD_REF: ${{ github.event.inputs.head_branch || github.event.workflow_run.head_branch }} | |
run: | | |
GITHUB_RUN_ID=$INPUT_RUN_ID \ | |
GITHUB_RUN_ATTEMPT=$INPUT_RUN_ATTEMPT \ | |
GITHUB_EVENT_NAME=$INPUT_EVENT_NAME \ | |
GITHUB_REF=refs/heads/$INPUT_REF \ | |
GITHUB_HEAD_REF=$INPUT_HEAD_REF \ | |
./buildpulse-action/run.sh |