Skip to content

Conversation

@shiningflash
Copy link
Owner

This pull request significantly enhances the CI workflow by improving test reporting, adding Allure dashboard integration, and refining workflow triggers and concurrency handling. The changes make test results more visible and actionable for pull requests and pushes, and automate the deployment of detailed test reports to GitHub Pages.

CI Workflow Improvements:

  • The workflow now triggers on additional pull request events (opened, synchronize, reopened, ready_for_review), ensuring tests run for all relevant PR updates.
  • Added push event triggers for the develop and main branches, and included changes to workflow files themselves as triggers.

Test Reporting and Allure Integration:

  • Integrated Allure reporting: installs Allure CLI, collects test results, pulls previous report history, generates a new dashboard, and deploys it to the allure-report branch on GitHub Pages.
  • Posts a comment on pull requests with a direct link to the Allure dashboard, including test status and a badge, updating the comment if it already exists.
  • Ensures the workflow fails if any tests fail, even if the report and comments are still generated.

Workflow Robustness and Permissions:

  • Adds concurrency control to prevent overlapping test runs for the same PR or branch, canceling in-progress jobs as needed.
  • Refines permissions to only those necessary for the workflow, moving them to the correct section.

Other Improvements:

  • Installs both Python and Node.js dependencies (for Allure), and streamlines environment setup for reliability and maintainability.

@shiningflash shiningflash requested a review from Copilot November 9, 2025 02:09
@github-actions
Copy link

github-actions bot commented Nov 9, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/core
   __init__.py00100% 
   config.py2322 91%
   logger.py220100% 
   requests.py1544 73%
   retry.py2111 95%
   security.py2622 92%
   validators.py400100% 
src/core/exceptions
   __init__.py40100% 
   api.py2911 97%
   decorators.py2377 70%
   resource.py130100% 
src/schemas
   __init__.py00100% 
   contacts.py140100% 
   errors.py170100% 
   messages.py3988 79%
   webhook.py80100% 
src/sdk
   __init__.py00100% 
   client.py4222 95%
src/sdk/features
   __init__.py00100% 
   contacts.py4733 94%
   messages.py441010 77%
src/server
   __init__.py00100% 
   app.py2633 88%
TOTAL4534391% 

Tests Skipped Failures Errors Time
55 0 💤 0 ❌ 0 🔥 7.066s ⏱️

@github-actions
Copy link

github-actions bot commented Nov 9, 2025

📊 Test Report ✅ All tests passed

Coverage trends • Module breakdown • Failure analysis • Execution timeline

View Allure Dashboard

⚠️ NB: If the dashboard doesn't update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the CI workflow by adding comprehensive Allure test reporting with visual dashboards and improves test failure handling. The workflow now generates and deploys interactive Allure reports to GitHub Pages and posts report links to pull requests.

Key changes:

  • Integration of Allure test reporting framework with historical trend tracking
  • Enhanced error handling to ensure reports are generated even when tests fail
  • Automated deployment of test reports to GitHub Pages with PR commenting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shiningflash shiningflash requested a review from Copilot November 9, 2025 02:14
@shiningflash shiningflash merged commit 9843d83 into main Nov 9, 2025
7 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

pip install --upgrade pip
pip install pytest pytest-cov allure-pytest
pip install -r requirements.txt
npm install -g allure-commandline
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing allure-commandline globally via npm on every workflow run is inefficient. Consider using a cached installation or a pre-built Docker image with Allure already installed. For example:

- name: Cache Allure CLI
  uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-allure-${{ hashFiles('**/package-lock.json') }}
    
- name: Install Allure CLI
  run: npm install -g allure-commandline

Copilot uses AI. Check for mistakes.
Comment on lines 53 to +59
- name: Install dependencies
run: |
python -m venv venv # Create a virtual environment
source venv/bin/activate # Activate the virtual environment
pip install --upgrade pip # Upgrade pip
pip install pytest pytest-cov # Install coverage tools
pip install -r requirements.txt # Install project dependencies
# Step 4: Run tests with coverage
- name: Run tests with coverage
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install pytest pytest-cov allure-pytest
pip install -r requirements.txt
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Python dependencies are installed on every run without caching, which is inefficient. Consider adding pip caching:

- name: Cache Python dependencies
  uses: actions/cache@v3
  with:
    path: |
      venv
      ~/.cache/pip
    key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
    restore-keys: |
      ${{ runner.os }}-pip-

- name: Install dependencies
  run: |
    python -m venv venv
    source venv/bin/activate
    pip install --upgrade pip
    pip install pytest pytest-cov allure-pytest
    pip install -r requirements.txt

Copilot uses AI. Check for mistakes.
Comment on lines +82 to +86
git checkout origin/allure-report -- history || true
if [ -d history ]; then
mkdir -p allure-results/history
cp -r history/* allure-results/history/ || true
fi
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git checkout operation on line 82 may fail in some scenarios because it's trying to checkout a path from a remote branch without proper setup. Consider using a more robust approach:

run: |
  git fetch origin allure-report || true
  if git ls-remote --exit-code origin allure-report; then
    git checkout origin/allure-report || true
    if [ -d history ]; then
      mkdir -p allure-results/history
      cp -r history/* allure-results/history/ || true
    fi
    git checkout - || true
  fi

This ensures you return to the original branch after checking out the history.

Suggested change
git checkout origin/allure-report -- history || true
if [ -d history ]; then
mkdir -p allure-results/history
cp -r history/* allure-results/history/ || true
fi
git checkout origin/allure-report || true
if [ -d history ]; then
mkdir -p allure-results/history
cp -r history/* allure-results/history/ || true
fi
git checkout - || true

Copilot uses AI. Check for mistakes.
Comment on lines +122 to +129
const body = `## 📊 Test Report ${testStatus}
Coverage trends • Module breakdown • Failure analysis • Execution timeline
[![View Allure Dashboard](https://img.shields.io/badge/View%20Dashboard-${badgeColor}?style=for-the-badge&logo=google-chrome&logoColor=white)](${reportUrl})
⚠️ NB: If the dashboard doesn't update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.`;
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown body contains incorrect indentation that will render as a code block. The lines should not be indented. Update to:

const body = `## 📊 Test Report ${testStatus}

Coverage trends • Module breakdown • Failure analysis • Execution timeline

[![View Allure Dashboard](https://img.shields.io/badge/View%20Dashboard-${badgeColor}?style=for-the-badge&logo=google-chrome&logoColor=white)](${reportUrl})

⚠️ NB: If the dashboard doesn't update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.`;

The current indentation will cause GitHub to render the content as preformatted code.

Suggested change
const body = `## 📊 Test Report ${testStatus}
Coverage trends • Module breakdown • Failure analysis • Execution timeline
[![View Allure Dashboard](https://img.shields.io/badge/View%20Dashboard-${badgeColor}?style=for-the-badge&logo=google-chrome&logoColor=white)](${reportUrl})
⚠️ NB: If the dashboard doesn't update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.`;
const body = [
`## 📊 Test Report ${testStatus}`,
'',
'Coverage trends • Module breakdown • Failure analysis • Execution timeline',
'',
`[![View Allure Dashboard](https://img.shields.io/badge/View%20Dashboard-${badgeColor}?style=for-the-badge&logo=google-chrome&logoColor=white)](${reportUrl})`,
'',
'⚠️ NB: If the dashboard doesn\'t update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.'
].join('\n');

Copilot uses AI. Check for mistakes.
Comment on lines +93 to +95
echo "<!-- build: run-${{ github.run_number }} -->" >> allure-report/index.html
touch allure-report/.nojekyll
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If allure generate fails and outputs the fallback message, the subsequent commands on lines 93-94 will fail because the allure-report directory won't exist. Consider adding a check:

run: |
  allure generate allure-results -o allure-report --clean || echo "No allure-results to generate"
  if [ -d allure-report ]; then
    echo "<!-- build: run-${{ github.run_number }} -->" >> allure-report/index.html
    touch allure-report/.nojekyll
  fi
Suggested change
echo "<!-- build: run-${{ github.run_number }} -->" >> allure-report/index.html
touch allure-report/.nojekyll
if [ -d allure-report ]; then
echo "<!-- build: run-${{ github.run_number }} -->" >> allure-report/index.html
touch allure-report/.nojekyll
fi

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +105
- name: Deploy Allure Report to GitHub Pages branch
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: allure-report
publish_dir: ./allure-report
keep_files: true
force_orphan: false
commit_message: "docs(allure): update report for ${{ github.sha }} (run ${{ github.run_number }})"
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The peaceiris/actions-gh-pages action will fail if the publish_dir (./allure-report) doesn't exist. Since the previous step may fail to generate the report, this step should check for the directory's existence:

- name: Deploy Allure Report to GitHub Pages branch
  if: always() && hashFiles('allure-report/index.html') != ''
  uses: peaceiris/actions-gh-pages@v3

Alternatively, add a condition to only deploy if the report was successfully generated.

Copilot uses AI. Check for mistakes.
env: # Load environment variables from repository secrets
permissions:
contents: write
pull-requests: write
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow is missing the checks: write permission that was present in the original version. This permission may be needed by the MishaKav/pytest-coverage-comment action to update check status. Consider adding it back:

permissions:
  contents: write
  pull-requests: write
  checks: write
Suggested change
pull-requests: write
pull-requests: write
checks: write

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants