diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index de76ed04a5f..bd5c60d7fe9 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -204,6 +204,13 @@ jobs: path: openmldb-*.tar.gz name: release-artifacts + - name: Upload Event File + if: always() + uses: actions/upload-artifact@v3 + with: + name: event-file + path: ${{ github.event_path }} + release: runs-on: ubuntu-latest # if test failed, shouldn't release diff --git a/.github/workflows/hybridse-ci.yml b/.github/workflows/hybridse-ci.yml index bd0f722fe39..7da8e5ac100 100644 --- a/.github/workflows/hybridse-ci.yml +++ b/.github/workflows/hybridse-ci.yml @@ -57,7 +57,7 @@ jobs: # this option enables print inner output rows of each node in runner HYBRIDSE_DEBUG: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: | @@ -79,6 +79,13 @@ jobs: run: | make hybridse-test + - name: Upload Event File + if: always() + uses: actions/upload-artifact@v3 + with: + name: event-file + path: ${{ github.event_path }} + - name: Upload Cpp UT Results if: always() uses: actions/upload-artifact@v3 @@ -89,7 +96,7 @@ jobs: publish-test-results-linux: needs: ["linux-build"] - # the action will only run on 4paradigm/HybridSE's context, not for fork repo or dependabot + # the action will only run on 4paradigm/OpenMLDB's context, not for fork repo or dependabot if: > always() && github.event_name == 'push' || ( github.event.pull_request.head.repo.full_name == github.repository && @@ -104,7 +111,7 @@ jobs: publish-test-results-mac: needs: ["macos-build"] - # the action will only run on 4paradigm/HybridSE's context, not for fork repo or dependabot + # the action will only run on 4paradigm/OpenMLDB's context, not for fork repo or dependabot if: > always() && github.event_name == 'push' || ( github.event.pull_request.head.repo.full_name == github.repository && diff --git a/.github/workflows/publish-test-result-from-fork.yml b/.github/workflows/publish-cicd-test-result-from-fork.yml similarity index 86% rename from .github/workflows/publish-test-result-from-fork.yml rename to .github/workflows/publish-cicd-test-result-from-fork.yml index 76682644ddf..2074f7a5e07 100644 --- a/.github/workflows/publish-test-result-from-fork.yml +++ b/.github/workflows/publish-cicd-test-result-from-fork.yml @@ -21,3 +21,5 @@ jobs: files: artifacts/linux-ut-result-*/**/*.xml check_name: Linux Test Report comment_title: Linux Test Report + event_name: ${{ github.event.workflow_run.event }} + run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/publish-hybridse-test-result-from-fork.yml b/.github/workflows/publish-hybridse-test-result-from-fork.yml index ff3a963eed8..0910d654dd2 100644 --- a/.github/workflows/publish-hybridse-test-result-from-fork.yml +++ b/.github/workflows/publish-hybridse-test-result-from-fork.yml @@ -21,6 +21,8 @@ jobs: files: artifacts/linux-ut-result-*/**/*.xml check_name: HybridSE Linux Test Report comment_title: HybridSE Linux Test Report + event_name: ${{ github.event.workflow_run.event }} + run_id: ${{ github.event.workflow_run.id }} test-results-mac: if: > @@ -31,7 +33,9 @@ jobs: name: Publish HybridSE Mac UT Results uses: ./.github/workflows/publish-test-result-from-fork-action.yml with: - commit: ${{ github.event.workflow_run.head_sha }} - files: artifacts/macos-ut-result-*/**/*.xml - check_name: HybridSE Mac Test Report - comment_title: HybridSE Mac Test Report + commit: ${{ github.event.workflow_run.head_sha }} + files: artifacts/macos-ut-result-*/**/*.xml + check_name: HybridSE Mac Test Report + comment_title: HybridSE Mac Test Report + event_name: ${{ github.event.workflow_run.event }} + run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/publish-sdk-test-result-from-fork.yml b/.github/workflows/publish-sdk-test-result-from-fork.yml index c030f4d3e0b..f99e456b844 100644 --- a/.github/workflows/publish-sdk-test-result-from-fork.yml +++ b/.github/workflows/publish-sdk-test-result-from-fork.yml @@ -21,3 +21,5 @@ jobs: files: artifacts/linux-ut-result-*/**/*.xml check_name: SDK Test Report comment_title: SDK Test Report + event_name: ${{ github.event.workflow_run.event }} + run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/publish-test-result-from-fork-action.yml b/.github/workflows/publish-test-result-from-fork-action.yml index 9521b823021..44d980f3148 100644 --- a/.github/workflows/publish-test-result-from-fork-action.yml +++ b/.github/workflows/publish-test-result-from-fork-action.yml @@ -7,54 +7,36 @@ on: files: required: true type: string + event_name: + required: true + type: string check_name: required: true type: string comment_title: required: true type: string + run_id: + required: true + type: number + +permissions: + checks: write + pull-requests: write + + # required by download step to access artifacts API + actions: read jobs: test-results: runs-on: ubuntu-latest steps: - - name: Download Artifacts - uses: actions/github-script@v3 + - name: Download and Extract Artifacts + uses: dawidd6/action-download-artifact@v3 with: - script: | - var fs = require('fs'); - var path = require('path'); - var artifacts_path = path.join('${{github.workspace}}', 'artifacts') - fs.mkdirSync(artifacts_path, { recursive: true }) - - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{ github.event.workflow_run.id }}, - }); + run_id: ${{ inputs.run_id }} + path: artifacts - for (const artifact of artifacts.data.artifacts) { - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: artifact.id, - archive_format: 'zip', - }); - var artifact_path = path.join(artifacts_path, `${artifact.name}.zip`) - fs.writeFileSync(artifact_path, Buffer.from(download.data)); - console.log(`Downloaded ${artifact_path}`); - } - - name: Extract Artifacts - run: | - for file in artifacts/*.zip - do - if [ -f "$file" ] - then - dir="${file/%.zip/}" - mkdir -p "$dir" - unzip -d "$dir" "$file" - fi - done - name: Publish UT Results uses: EnricoMi/publish-unit-test-result-action@v2 with: @@ -62,3 +44,6 @@ jobs: files: ${{ inputs.files }} check_name: ${{ inputs.check_name }} comment_title: ${{ inputs.comment_title }} + event_name: ${{ inputs.event_name }} + # u should upload the event file with upload name 'event-file' + event_file: artifacts/event-file/event.json diff --git a/.github/workflows/publish-test-results-action.yml b/.github/workflows/publish-test-results-action.yml index 5b13c8b9c68..841929c1cb1 100644 --- a/.github/workflows/publish-test-results-action.yml +++ b/.github/workflows/publish-test-results-action.yml @@ -11,6 +11,10 @@ on: required: true type: string +permissions: + checks: write + pull-requests: write + jobs: publish-test-results: runs-on: ubuntu-latest diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 7fd0a6f1cdd..b40fa87f331 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -100,6 +100,13 @@ jobs: run: | ./mvnw --batch-mode test + - name: Upload Event File + if: always() + uses: actions/upload-artifact@v2 + with: + name: event-file + path: ${{ github.event_path }} + - name: upload java ut results if: always() uses: actions/upload-artifact@v2