From 20a2167b75e5d7eee0fc4e588db2f0800273ed4c Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Mon, 24 Nov 2025 10:49:02 +0800 Subject: [PATCH 01/11] setup action for github comment --- .github/actions/add-comment/action.yml | 47 ++++++++++++++++++++++++ .github/workflows/_linux_e2e_summary.yml | 14 +------ 2 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 .github/actions/add-comment/action.yml diff --git a/.github/actions/add-comment/action.yml b/.github/actions/add-comment/action.yml new file mode 100644 index 0000000000..952898a2ee --- /dev/null +++ b/.github/actions/add-comment/action.yml @@ -0,0 +1,47 @@ +name: CI Tests with Detailed Report + +inputs: + commentBody: + type: string + default: '' + description: Path to summary report html file + + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + - name: Post readable test report + shell: bash -xe {0} + uses: actions/github-script@v7 + with: + script: | + // Read the comment content from a file + const fs = require('fs'); + const commentBody = fs.readFileSync('${{ inputs.commentBody }}', 'utf8'); + // Get existing comments + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + // Find existing bot comment + const existingComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('# ๐Ÿงช CI Test Summary Report') + ); + if (existingComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body: commentBody + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: commentBody + }); + } diff --git a/.github/workflows/_linux_e2e_summary.yml b/.github/workflows/_linux_e2e_summary.yml index 42955817f9..719ade7671 100644 --- a/.github/workflows/_linux_e2e_summary.yml +++ b/.github/workflows/_linux_e2e_summary.yml @@ -95,19 +95,9 @@ jobs: gh --repo ${GITHUB_REPOSITORY} issue edit ${REFERENCE_ISSUE_ID} --body-file new_body.txt - name: Add comment for performance outliers if: ${{ github.event_name == 'pull_request' && steps.summary.outputs.performance_regression == 1 }} - uses: actions/github-script@v7 + uses: .github/actions/add-comment with: - script: | - // Read the comment content from a file - const fs = require('fs'); - const commentBody = fs.readFileSync('./performance.regression.pr.html', 'utf8'); - // Create comment on an issue or PR - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: commentBody - }); + commentBody: './performance.regression.pr.html' - name: Result check if: ${{ ! cancelled() }} run: | From 4fdec47c9c3df4f8741d687b5aa84deff1b249ac Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Mon, 24 Nov 2025 14:30:44 +0800 Subject: [PATCH 02/11] init report --- .ci/templates/ci-report.txt | 17 +++++++++++++++++ .github/workflows/pull.yml | 28 +++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 .ci/templates/ci-report.txt diff --git a/.ci/templates/ci-report.txt b/.ci/templates/ci-report.txt new file mode 100644 index 0000000000..d645b5ebe8 --- /dev/null +++ b/.ci/templates/ci-report.txt @@ -0,0 +1,17 @@ +# ๐Ÿงช CI Test Summary Report + +## ๐Ÿ“Š Executive Summary +โณ **All tests scheduled!** Waiting for launch. + +## ๐Ÿ“ˆ Category-Specific Results + +| Category | Status | Acc/UT Total | Acc/UT Pass Rate | Perf Eager Ratio | Perf Inductor Ratio | +|-----------------|----------|--------------|-------------------|------------------|---------------------| +| **Lnit Check** | WIP | +| **Unit Tests** | WIP | +| **HuggingFace** | WIP | +| **Timm Models** | WIP | +| **TorchBench** | WIP | + +## ๐Ÿ” Test Details +- **Workflow:** https://github.com/GITHUB_REPOSITORY/actions/runs/GITHUB_RUN_ID diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 6c26af3c71..4fb4bf2af5 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -41,14 +41,28 @@ jobs: git clone https://github.com/pytorch/pytorch pytorch cd pytorch && cp -r ../torch-xpu-ops third_party/ export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \ - build/xpu/**/*.* \ - build/xpu/*.* \ - third_party/torch-xpu-ops/src/*.* \ - third_party/torch-xpu-ops/src/**/*.* \ - third_party/torch-xpu-ops/src/**/**/*.* \ - third_party/torch-xpu-ops/src/**/**/**/*.*" + build/xpu/**/*.* \ + build/xpu/*.* \ + third_party/torch-xpu-ops/src/*.* \ + third_party/torch-xpu-ops/src/**/*.* \ + third_party/torch-xpu-ops/src/**/**/*.* \ + third_party/torch-xpu-ops/src/**/**/**/*.*" export CLANG=1 - bash third_party/torch-xpu-ops/.github/scripts/lintrunner.sh + # Run lint check with proper error handling and reporting + lint_script="third_party/torch-xpu-ops/.github/scripts/lintrunner.sh" + ci_report="${{ github.workspace }}/.ci/templates/ci-report.txt" + if bash "$lint_script"; then + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" + echo "Lint check: PASSED" + else + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โŒ|1|0%|N/A|N/A|+' "$ci_report" + echo "Lint check: FAILED" + exit 1 + fi + - name: Init test summary result + uses: .github/actions/add-comment + with: + commentBody: .ci/templates/ci-report.txt conditions-filter: if: ${{ github.repository_owner == 'intel' && github.event.pull_request.draft == false }} From 2acea6e4e5f6cf423e09abf8a3ad96319bdc81ff Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Mon, 24 Nov 2025 14:32:57 +0800 Subject: [PATCH 03/11] update --- .github/workflows/pull.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 4fb4bf2af5..da6c4522c2 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -60,7 +60,7 @@ jobs: exit 1 fi - name: Init test summary result - uses: .github/actions/add-comment + uses: ./.github/actions/add-comment with: commentBody: .ci/templates/ci-report.txt From a9b9b9f218b29732ad09daf99744406fb89ba0ea Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Mon, 24 Nov 2025 14:40:19 +0800 Subject: [PATCH 04/11] update --- .ci/templates/ci-report.txt | 1 + .github/workflows/_linux_e2e_summary.yml | 2 +- .github/workflows/pull.yml | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.ci/templates/ci-report.txt b/.ci/templates/ci-report.txt index d645b5ebe8..79f2b09cf7 100644 --- a/.ci/templates/ci-report.txt +++ b/.ci/templates/ci-report.txt @@ -8,6 +8,7 @@ | Category | Status | Acc/UT Total | Acc/UT Pass Rate | Perf Eager Ratio | Perf Inductor Ratio | |-----------------|----------|--------------|-------------------|------------------|---------------------| | **Lnit Check** | WIP | +| **Clang Check** | WIP | | **Unit Tests** | WIP | | **HuggingFace** | WIP | | **Timm Models** | WIP | diff --git a/.github/workflows/_linux_e2e_summary.yml b/.github/workflows/_linux_e2e_summary.yml index 719ade7671..746cc87af2 100644 --- a/.github/workflows/_linux_e2e_summary.yml +++ b/.github/workflows/_linux_e2e_summary.yml @@ -95,7 +95,7 @@ jobs: gh --repo ${GITHUB_REPOSITORY} issue edit ${REFERENCE_ISSUE_ID} --body-file new_body.txt - name: Add comment for performance outliers if: ${{ github.event_name == 'pull_request' && steps.summary.outputs.performance_regression == 1 }} - uses: .github/actions/add-comment + uses: ./.github/actions/add-comment with: commentBody: './performance.regression.pr.html' - name: Result check diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index da6c4522c2..636c0ad5bb 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -31,9 +31,20 @@ jobs: path: torch-xpu-ops - name: Run lint check run: | - export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" cd ./torch-xpu-ops - bash .github/scripts/lintrunner.sh + lint_script=".github/scripts/lintrunner.sh" + ci_report="${{ github.workspace }}/.ci/templates/ci-report.txt" + sed -i 's+GITHUB_REPOSITORY+${{ github.repository }}+;s+GITHUB_RUN_ID+${{ github.run_id }}+' ${ci_report} + # Run lint check with proper error handling and reporting + export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" + if bash "$lint_script"; then + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" + echo "Lint check: PASSED" + else + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โŒ|1|0%|N/A|N/A|+' "$ci_report" + echo "Lint check: FAILED" + exit 1 + fi - name: Run lint check with Clang run: | sudo apt update && sudo apt install -y libomp-dev @@ -52,10 +63,10 @@ jobs: lint_script="third_party/torch-xpu-ops/.github/scripts/lintrunner.sh" ci_report="${{ github.workspace }}/.ci/templates/ci-report.txt" if bash "$lint_script"; then - sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" + sed -i 's+.*Clang Check.*+|**Clang Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" echo "Lint check: PASSED" else - sed -i 's+.*Lnit Check.*+|**Lnit Check**|โŒ|1|0%|N/A|N/A|+' "$ci_report" + sed -i 's+.*Clang Check.*+|**Clang Check**|โŒ|1|0%|N/A|N/A|+' "$ci_report" echo "Lint check: FAILED" exit 1 fi From 67e702e2b637101a35509e0b0cdbb4ca7bd19cd1 Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Mon, 24 Nov 2025 15:48:58 +0800 Subject: [PATCH 05/11] update --- .github/workflows/pull.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 636c0ad5bb..37a46c9126 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -33,7 +33,7 @@ jobs: run: | cd ./torch-xpu-ops lint_script=".github/scripts/lintrunner.sh" - ci_report="${{ github.workspace }}/.ci/templates/ci-report.txt" + ci_report="${{ github.workspace }}/torch-xpu-ops/.ci/templates/ci-report.txt" sed -i 's+GITHUB_REPOSITORY+${{ github.repository }}+;s+GITHUB_RUN_ID+${{ github.run_id }}+' ${ci_report} # Run lint check with proper error handling and reporting export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" @@ -61,7 +61,7 @@ jobs: export CLANG=1 # Run lint check with proper error handling and reporting lint_script="third_party/torch-xpu-ops/.github/scripts/lintrunner.sh" - ci_report="${{ github.workspace }}/.ci/templates/ci-report.txt" + ci_report="${{ github.workspace }}/torch-xpu-ops/.ci/templates/ci-report.txt" if bash "$lint_script"; then sed -i 's+.*Clang Check.*+|**Clang Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" echo "Lint check: PASSED" From ab068d72fea96dbef910f79fbf522179105f46e4 Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Mon, 24 Nov 2025 17:03:30 +0800 Subject: [PATCH 06/11] update --- .github/workflows/pull.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 37a46c9126..10daef040b 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -71,7 +71,7 @@ jobs: exit 1 fi - name: Init test summary result - uses: ./.github/actions/add-comment + uses: ./torch-xpu-ops/.github/actions/add-comment with: commentBody: .ci/templates/ci-report.txt From 614776cc3144838aaee3b6c7bf3a97088b16246a Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Thu, 27 Nov 2025 11:39:17 +0800 Subject: [PATCH 07/11] update lint check --- .github/actions/lint-checks/action.yml | 61 ++++++++++++++++++++++++++ .github/workflows/pull.yml | 57 +++++------------------- 2 files changed, 73 insertions(+), 45 deletions(-) create mode 100644 .github/actions/lint-checks/action.yml diff --git a/.github/actions/lint-checks/action.yml b/.github/actions/lint-checks/action.yml new file mode 100644 index 0000000000..049fca4216 --- /dev/null +++ b/.github/actions/lint-checks/action.yml @@ -0,0 +1,61 @@ +name: 'Run Lint Checks' +description: 'Execute code quality and linting checks' + +runs: + using: "composite" + steps: + - name: Run Standard Lint Check + shell: bash + run: | + ci_report=".ci/templates/ci-report.txt" + + # Update CI report template + sed -i "s+GITHUB_REPOSITORY+${{ github.repository }}+g;s+GITHUB_RUN_ID+${{ github.run_id }}+g" "${ci_report}" + + # Run lint check + export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" + + if bash ".github/scripts/lintrunner.sh"; then + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "${ci_report}" + echo "โœ… Standard lint check passed" + else + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โŒ|1|0%|N/A|N/A|+' "${ci_report}" + echo "โŒ Standard lint check failed" + exit 1 + fi + - name: Checkout Repository + uses: actions/checkout@v4 + with: + path: torch-xpu-ops + - name: Run Clang-based Lint Check + shell: bash + run: | + set -euo pipefail + + # Clone PyTorch and setup environment + rm -rf pytorch + git clone https://github.com/pytorch/pytorch pytorch + + cd pytorch + cp -r ../torch-xpu-ops third_party/ + + # Configure and run clang checks + export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \ + build/xpu/**/*.* \ + build/xpu/*.* \ + third_party/torch-xpu-ops/src/*.* \ + third_party/torch-xpu-ops/src/**/*.* \ + third_party/torch-xpu-ops/src/**/**/*.* \ + third_party/torch-xpu-ops/src/**/**/**/*.*" + export CLANG=1 + + ci_report="../.ci/templates/ci-report.txt" + + if bash "third_party/torch-xpu-ops/.github/scripts/lintrunner.sh"; then + sed -i 's+.*Clang Check.*+|**Clang Check**|โœ…|1|100%|N/A|N/A|+' "${ci_report}" + echo "โœ… Clang lint check passed" + else + sed -i 's+.*Clang Check.*+|**Clang Check**|โŒ|1|0%|N/A|N/A|+' "${ci_report}" + echo "โŒ Clang lint check failed" + exit 1 + fi diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 10daef040b..06e001c125 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -25,53 +25,20 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - - name: Checkout torch-xpu-ops + - name: Checkout Repository uses: actions/checkout@v4 - with: - path: torch-xpu-ops - - name: Run lint check - run: | - cd ./torch-xpu-ops - lint_script=".github/scripts/lintrunner.sh" - ci_report="${{ github.workspace }}/torch-xpu-ops/.ci/templates/ci-report.txt" - sed -i 's+GITHUB_REPOSITORY+${{ github.repository }}+;s+GITHUB_RUN_ID+${{ github.run_id }}+' ${ci_report} - # Run lint check with proper error handling and reporting - export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" - if bash "$lint_script"; then - sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" - echo "Lint check: PASSED" - else - sed -i 's+.*Lnit Check.*+|**Lnit Check**|โŒ|1|0%|N/A|N/A|+' "$ci_report" - echo "Lint check: FAILED" - exit 1 - fi - - name: Run lint check with Clang + + - name: Setup Linting Environment run: | - sudo apt update && sudo apt install -y libomp-dev - rm -rf pytorch - git clone https://github.com/pytorch/pytorch pytorch - cd pytorch && cp -r ../torch-xpu-ops third_party/ - export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \ - build/xpu/**/*.* \ - build/xpu/*.* \ - third_party/torch-xpu-ops/src/*.* \ - third_party/torch-xpu-ops/src/**/*.* \ - third_party/torch-xpu-ops/src/**/**/*.* \ - third_party/torch-xpu-ops/src/**/**/**/*.*" - export CLANG=1 - # Run lint check with proper error handling and reporting - lint_script="third_party/torch-xpu-ops/.github/scripts/lintrunner.sh" - ci_report="${{ github.workspace }}/torch-xpu-ops/.ci/templates/ci-report.txt" - if bash "$lint_script"; then - sed -i 's+.*Clang Check.*+|**Clang Check**|โœ…|1|100%|N/A|N/A|+' "$ci_report" - echo "Lint check: PASSED" - else - sed -i 's+.*Clang Check.*+|**Clang Check**|โŒ|1|0%|N/A|N/A|+' "$ci_report" - echo "Lint check: FAILED" - exit 1 - fi - - name: Init test summary result - uses: ./torch-xpu-ops/.github/actions/add-comment + sudo apt-get update + sudo apt-get install -y libomp-dev dos2unix + + - name: Run Code Quality Checks + id: lint-checks + uses: ./.github/actions/lint-checks + + - name: Initialize Test Summary + uses: ./.github/actions/add-comment with: commentBody: .ci/templates/ci-report.txt From 08b9c84cfffd066c7a654c2057fb93443791793e Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Thu, 27 Nov 2025 13:30:20 +0800 Subject: [PATCH 08/11] update --- .github/actions/add-comment/action.yml | 118 +++++++++++++----- .github/actions/lint-checks/action.yml | 16 +-- .github/workflows/_linux_e2e_summary.yml | 2 +- .github/workflows/_performance_comparison.yml | 2 +- .github/workflows/_windows_ut.yml | 8 +- .github/workflows/pull.yml | 14 +-- 6 files changed, 106 insertions(+), 54 deletions(-) diff --git a/.github/actions/add-comment/action.yml b/.github/actions/add-comment/action.yml index 952898a2ee..3d392dcef7 100644 --- a/.github/actions/add-comment/action.yml +++ b/.github/actions/add-comment/action.yml @@ -1,47 +1,99 @@ -name: CI Tests with Detailed Report +name: CI Test Report Publisher +description: 'Publishes detailed test reports as GitHub comments with smart updates' inputs: - commentBody: - type: string - default: '' - description: Path to summary report html file - + comment-body: + description: 'Path to the summary report HTML file' + required: true + default: 'test-results/report.html' + report-title: + description: 'Title for the test report comment' + required: false + default: '๐Ÿงช CI Test Summary Report' + max-comment-length: + description: 'Maximum comment length to avoid API limits' + required: false + default: '65536' runs: using: composite steps: - - uses: actions/checkout@v4 - - name: Post readable test report - shell: bash -xe {0} + - name: Validate inputs + shell: bash + run: | + if [[ ! -f "${{ inputs.comment-body }}" ]]; then + echo "โŒ Report file not found: ${{ inputs.comment-body }}" + exit 1 + fi + + - name: Post test report + shell: bash + env: + REPORT_FILE: "${{ inputs.comment-body }}" + MAX_LENGTH: "${{ inputs.max-comment-length }}" + run: | + # Read and sanitize report content + report_content=$(< "$REPORT_FILE") + + # Truncate if exceeding GitHub comment limits + if [ ${#report_content} -gt $MAX_LENGTH ]; then + echo "โš ๏ธ Report content too long, truncating..." + report_content="${report_content:0:$MAX_LENGTH}" + report_content+="\n\n---\n*Report truncated due to length limits*" + fi + + # Escape content for JSON + escaped_content=$(jq -R -s -c '.' <<< "$report_content") + + echo "escaped_content<> $GITHUB_ENV + echo "$escaped_content" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Publish or update comment uses: actions/github-script@v7 + env: + COMMENT_BODY: ${{ env.comment_body }} with: script: | - // Read the comment content from a file - const fs = require('fs'); - const commentBody = fs.readFileSync('${{ inputs.commentBody }}', 'utf8'); - // Get existing comments - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - // Find existing bot comment - const existingComment = comments.find(comment => - comment.user.type === 'Bot' && - comment.body.includes('# ๐Ÿงช CI Test Summary Report') - ); - if (existingComment) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: existingComment.id, - body: commentBody - }); - } else { - await github.rest.issues.createComment({ + const { COMMENT_BODY } = process.env; + + // Helper function to find bot comments + const findBotComment = async () => { + const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: commentBody }); + + return comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('${{ inputs.report-title }}') + ); + }; + + try { + const existingComment = await findBotComment(); + + if (existingComment) { + console.log('๐Ÿ“ Updating existing test report comment'); + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body: COMMENT_BODY + }); + } else { + console.log('๐Ÿ’ฌ Creating new test report comment'); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: COMMENT_BODY + }); + } + + console.log('โœ… Test report published successfully'); + } catch (error) { + console.error('โŒ Failed to publish test report:', error.message); + throw error; } diff --git a/.github/actions/lint-checks/action.yml b/.github/actions/lint-checks/action.yml index 049fca4216..271530180b 100644 --- a/.github/actions/lint-checks/action.yml +++ b/.github/actions/lint-checks/action.yml @@ -8,13 +8,13 @@ runs: shell: bash run: | ci_report=".ci/templates/ci-report.txt" - + # Update CI report template sed -i "s+GITHUB_REPOSITORY+${{ github.repository }}+g;s+GITHUB_RUN_ID+${{ github.run_id }}+g" "${ci_report}" - + # Run lint check export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" - + if bash ".github/scripts/lintrunner.sh"; then sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "${ci_report}" echo "โœ… Standard lint check passed" @@ -31,14 +31,14 @@ runs: shell: bash run: | set -euo pipefail - + # Clone PyTorch and setup environment rm -rf pytorch git clone https://github.com/pytorch/pytorch pytorch - + cd pytorch cp -r ../torch-xpu-ops third_party/ - + # Configure and run clang checks export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \ build/xpu/**/*.* \ @@ -48,9 +48,9 @@ runs: third_party/torch-xpu-ops/src/**/**/*.* \ third_party/torch-xpu-ops/src/**/**/**/*.*" export CLANG=1 - + ci_report="../.ci/templates/ci-report.txt" - + if bash "third_party/torch-xpu-ops/.github/scripts/lintrunner.sh"; then sed -i 's+.*Clang Check.*+|**Clang Check**|โœ…|1|100%|N/A|N/A|+' "${ci_report}" echo "โœ… Clang lint check passed" diff --git a/.github/workflows/_linux_e2e_summary.yml b/.github/workflows/_linux_e2e_summary.yml index 746cc87af2..39dbbbad7f 100644 --- a/.github/workflows/_linux_e2e_summary.yml +++ b/.github/workflows/_linux_e2e_summary.yml @@ -97,7 +97,7 @@ jobs: if: ${{ github.event_name == 'pull_request' && steps.summary.outputs.performance_regression == 1 }} uses: ./.github/actions/add-comment with: - commentBody: './performance.regression.pr.html' + comment-body: './performance.regression.pr.html' - name: Result check if: ${{ ! cancelled() }} run: | diff --git a/.github/workflows/_performance_comparison.yml b/.github/workflows/_performance_comparison.yml index 5a0d08993b..53ce959cd8 100644 --- a/.github/workflows/_performance_comparison.yml +++ b/.github/workflows/_performance_comparison.yml @@ -25,7 +25,7 @@ jobs: - name: Setup python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.10' - name: Checkout torch-xpu-ops uses: actions/checkout@v4 - name: Downlaod artifacts diff --git a/.github/workflows/_windows_ut.yml b/.github/workflows/_windows_ut.yml index 28ec8bbfe4..f27051ff25 100644 --- a/.github/workflows/_windows_ut.yml +++ b/.github/workflows/_windows_ut.yml @@ -46,7 +46,7 @@ on: permissions: read-all -env: +env: USE_XPU: 1 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: >- intel-cmplr-lib-rt==2025.2.1 | @@ -156,8 +156,8 @@ jobs: git config --global core.symlinks true git config --global core.fsmonitor false powershell -Command "Set-ItemProperty -Path "HKLM:\\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1" - git status - git show -s + git status + git show -s git submodule sync && git submodule update --init --recursive if %TORCH_XPU_OPS_COMMIT% == 'pinned' ( echo "Don't replace torch-xpu-ops!" @@ -277,7 +277,7 @@ jobs: REM Check the failure logs if exist "%GITHUB_WORKSPACE%\failures*.log" ( echo Exist Failure logs - echo Found Failure logs as below: + echo Found Failure logs as below: for %%f in ("%GITHUB_WORKSPACE%\failures*.log") do ( echo - %%f copy "%%f" "%GITHUB_WORKSPACE%\ut_log\" diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 06e001c125..00c9c7b12f 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -27,20 +27,20 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - + - name: Setup Linting Environment run: | sudo apt-get update sudo apt-get install -y libomp-dev dos2unix - + - name: Run Code Quality Checks id: lint-checks uses: ./.github/actions/lint-checks - - name: Initialize Test Summary + - name: Publish test report uses: ./.github/actions/add-comment with: - commentBody: .ci/templates/ci-report.txt + comment-body: './.ci/templates/ci-report.txt' conditions-filter: if: ${{ github.repository_owner == 'intel' && github.event.pull_request.draft == false }} @@ -58,7 +58,7 @@ jobs: id: check-files with: filters: | - src_changed: + src_changed: - 'cmake/**' - 'tools/**' - 'src/**.cmake' @@ -153,11 +153,11 @@ jobs: windows: name: windows - if: ${{ !(contains(needs.conditions-filter.outputs.disabled_tests, 'disable_all') || contains(needs.conditions-filter.outputs.disabled_tests, 'disable_win')) }} + if: ${{ !(contains(needs.conditions-filter.outputs.disabled_tests, 'disable_all') || contains(needs.conditions-filter.outputs.disabled_tests, 'disable_win')) }} needs: [conditions-filter, preci-lint-check] secrets: inherit uses: ./.github/workflows/_windows_ut.yml - with: + with: ut: op_extended,test_xpu runner: Windows_CI src_changed: ${{ needs.conditions-filter.outputs.src_changed }} From a50f61a355348954b011cf2e6bb6c54a55e9c5cd Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Thu, 27 Nov 2025 13:51:13 +0800 Subject: [PATCH 09/11] update --- .github/workflows/pull.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 00c9c7b12f..1222420e5e 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -24,6 +24,11 @@ jobs: if: ${{ github.repository_owner == 'intel' }} runs-on: ubuntu-24.04 timeout-minutes: 30 + permissions: + issues: write + pull-requests: write + env: + GH_TOKEN: ${{ github.token }} steps: - name: Checkout Repository uses: actions/checkout@v4 From fe2f36cd38c185aea05274e66cb578b0bf3ccadf Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Thu, 27 Nov 2025 14:17:30 +0800 Subject: [PATCH 10/11] update --- .github/actions/add-comment/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/add-comment/action.yml b/.github/actions/add-comment/action.yml index 3d392dcef7..dfa8db4cb1 100644 --- a/.github/actions/add-comment/action.yml +++ b/.github/actions/add-comment/action.yml @@ -52,7 +52,7 @@ runs: - name: Publish or update comment uses: actions/github-script@v7 env: - COMMENT_BODY: ${{ env.comment_body }} + COMMENT_BODY: ${{ env.escaped_content }} with: script: | const { COMMENT_BODY } = process.env; @@ -66,7 +66,6 @@ runs: }); return comments.find(comment => - comment.user.type === 'Bot' && comment.body.includes('${{ inputs.report-title }}') ); }; From 6d332caf82406cd7e31b0d13c37c3ec43bc5925b Mon Sep 17 00:00:00 2001 From: mengfei25 Date: Thu, 27 Nov 2025 15:06:33 +0800 Subject: [PATCH 11/11] update --- .github/actions/add-comment/action.yml | 41 ++++---------------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/.github/actions/add-comment/action.yml b/.github/actions/add-comment/action.yml index dfa8db4cb1..a2cf5b6c24 100644 --- a/.github/actions/add-comment/action.yml +++ b/.github/actions/add-comment/action.yml @@ -10,10 +10,6 @@ inputs: description: 'Title for the test report comment' required: false default: '๐Ÿงช CI Test Summary Report' - max-comment-length: - description: 'Maximum comment length to avoid API limits' - required: false - default: '65536' runs: using: composite @@ -25,37 +21,13 @@ runs: echo "โŒ Report file not found: ${{ inputs.comment-body }}" exit 1 fi - - - name: Post test report - shell: bash - env: - REPORT_FILE: "${{ inputs.comment-body }}" - MAX_LENGTH: "${{ inputs.max-comment-length }}" - run: | - # Read and sanitize report content - report_content=$(< "$REPORT_FILE") - - # Truncate if exceeding GitHub comment limits - if [ ${#report_content} -gt $MAX_LENGTH ]; then - echo "โš ๏ธ Report content too long, truncating..." - report_content="${report_content:0:$MAX_LENGTH}" - report_content+="\n\n---\n*Report truncated due to length limits*" - fi - - # Escape content for JSON - escaped_content=$(jq -R -s -c '.' <<< "$report_content") - - echo "escaped_content<> $GITHUB_ENV - echo "$escaped_content" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - name: Publish or update comment uses: actions/github-script@v7 - env: - COMMENT_BODY: ${{ env.escaped_content }} with: script: | - const { COMMENT_BODY } = process.env; + // Read the comment content from a file + const fs = require('fs'); + const commentBody = fs.readFileSync('${{ inputs.comment-body }}', 'utf8'); // Helper function to find bot comments const findBotComment = async () => { @@ -64,7 +36,6 @@ runs: repo: context.repo.repo, issue_number: context.issue.number, }); - return comments.find(comment => comment.body.includes('${{ inputs.report-title }}') ); @@ -72,14 +43,13 @@ runs: try { const existingComment = await findBotComment(); - if (existingComment) { console.log('๐Ÿ“ Updating existing test report comment'); await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: existingComment.id, - body: COMMENT_BODY + body: commentBody }); } else { console.log('๐Ÿ’ฌ Creating new test report comment'); @@ -87,10 +57,9 @@ runs: owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: COMMENT_BODY + body: commentBody }); } - console.log('โœ… Test report published successfully'); } catch (error) { console.error('โŒ Failed to publish test report:', error.message);