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: fix publish hybridse test result from fork #3738

Merged
merged 1 commit into from
Jan 31, 2024
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
7 changes: 7 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/hybridse-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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 &&
Expand All @@ -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 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
12 changes: 8 additions & 4 deletions .github/workflows/publish-hybridse-test-result-from-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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 }}
2 changes: 2 additions & 0 deletions .github/workflows/publish-sdk-test-result-from-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
55 changes: 20 additions & 35 deletions .github/workflows/publish-test-result-from-fork-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,43 @@ 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:
commit: ${{ inputs.commit }}
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
4 changes: 4 additions & 0 deletions .github/workflows/publish-test-results-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
required: true
type: string

permissions:
checks: write
pull-requests: write

jobs:
publish-test-results:
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading