From 68d766571ddd57a10c08338da23ff7b06759a46c Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 20:55:43 +0100 Subject: [PATCH 01/30] test: trigger CI workflow --- .github/workflows/ci.yml | 43 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a91d47..1d02357 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,51 +11,54 @@ on: - "src/**" - "tests/**" -permissions: - contents: write - pull-requests: write - checks: write - jobs: test: name: Run Tests and Post Coverage runs-on: ubuntu-latest - - env: # Load environment variables from repository secrets + permissions: + contents: write + pull-requests: write + checks: write + pages: write # added for publishing + id-token: write # needed by some actions + env: BASE_URL: ${{ secrets.BASE_URL }} API_KEY: ${{ secrets.API_KEY }} WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} - steps: - # Step 1: Checkout the repository code - name: Checkout code uses: actions/checkout@v3 - # Step 2: Set up Python environment - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.9" - # Step 3: Install dependencies - 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 + python -m venv venv + source venv/bin/activate + pip install --upgrade pip + pip install pytest pytest-cov allure-pytest + pip install -r requirements.txt - # Step 4: Run tests with coverage - - name: Run tests with coverage + - name: Run tests with coverage + allure results run: | source venv/bin/activate - pytest --cov=src --cov-report=xml --cov-report=term > coverage.txt + pytest --cov=src --cov-report=xml --cov-report=term \ + --alluredir=allure-results > coverage.txt pytest --junitxml=pytest.xml - # Step 5: Post coverage summary to the pull request - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: pytest-coverage-path: ./coverage.txt junitxml-path: ./pytest.xml + - name: Publish Allure Report + uses: simple-works/allure-report-action@v1 + if: github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' + with: + allure_results: allure-results + allure_report: allure-report + allure_history: allure-history + gh_pages: true From 7ec325eff96bd280f1d66955377763f66431e7d5 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 20:59:27 +0100 Subject: [PATCH 02/30] include path --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d02357..feaf02f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: paths: - "src/**" - "tests/**" + - ".github/workflows/**" jobs: test: From dcdf4aae76ea48f9c0c326a52dd2158f4cfa48d9 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:01:10 +0100 Subject: [PATCH 03/30] change allure path --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feaf02f..13ae411 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,10 +56,11 @@ jobs: pytest-coverage-path: ./coverage.txt junitxml-path: ./pytest.xml - name: Publish Allure Report - uses: simple-works/allure-report-action@v1 - if: github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' + uses: afiore/action-allure-report-publish@v0.5.0 + if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' with: allure_results: allure-results allure_report: allure-report allure_history: allure-history gh_pages: true + gh_pages_branch: gh-pages From ff0ef6be713b7ae91b0f0cf73bae31743f452060 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:02:04 +0100 Subject: [PATCH 04/30] first generate the Allure report --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13ae411..49ca368 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,13 @@ jobs: --alluredir=allure-results > coverage.txt pytest --junitxml=pytest.xml + - name: Generate Allure Report + if: always() + run: | + source venv/bin/activate + pip install allure-behave + allure generate allure-results -o allure-report --clean + - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main with: From ba9b14a1e1f263588f59879bf6228c521e83d582 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:15:56 +0100 Subject: [PATCH 05/30] Update ci.yml --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49ca368..dca0bb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,15 @@ on: - "src/**" - "tests/**" - ".github/workflows/**" + push: + branches: + - develop + - main + - workflows-improvement + paths: + - "src/**" + - "tests/**" + - ".github/workflows/**" jobs: test: @@ -19,9 +28,6 @@ jobs: permissions: contents: write pull-requests: write - checks: write - pages: write # added for publishing - id-token: write # needed by some actions env: BASE_URL: ${{ secrets.BASE_URL }} API_KEY: ${{ secrets.API_KEY }} @@ -35,6 +41,11 @@ jobs: with: python-version: "3.9" + - name: Set up Node (for Allure CLI) + uses: actions/setup-node@v4 + with: + node-version: "18" + - name: Install dependencies run: | python -m venv venv @@ -42,32 +53,45 @@ jobs: pip install --upgrade pip pip install pytest pytest-cov allure-pytest pip install -r requirements.txt + npm install -g allure-commandline - - name: Run tests with coverage + allure results + - name: Run tests (coverage + allure results) run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ --alluredir=allure-results > coverage.txt pytest --junitxml=pytest.xml + - name: Pull previous Allure history (if exists) + run: | + git fetch origin allure-report || true + if git ls-remote --exit-code origin allure-report; then + git checkout origin/allure-report -- history || true + if [ -d history ]; then + mkdir -p allure-results/history + cp -r history/* allure-results/history/ || true + fi + fi + continue-on-error: true + - name: Generate Allure Report - if: always() run: | - source venv/bin/activate - pip install allure-behave allure generate allure-results -o allure-report --clean + if [ -d allure-report/history ]; then ls -R allure-report/history | head -n 20; fi - - name: Pytest coverage comment + - name: Pytest coverage comment (PR only) + if: github.event_name == 'pull_request' uses: MishaKav/pytest-coverage-comment@main with: pytest-coverage-path: ./coverage.txt junitxml-path: ./pytest.xml - - name: Publish Allure Report - uses: afiore/action-allure-report-publish@v0.5.0 - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' + + - name: Deploy Allure Report to GitHub Pages branch + if: github.event_name == 'push' + uses: peaceiris/actions-gh-pages@v3 with: - allure_results: allure-results - allure_report: allure-report - allure_history: allure-history - gh_pages: true - gh_pages_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: allure-report + publish_dir: ./allure-report + keep_files: false + force_orphan: false From 4e76868eab330b722a34f670f6555aed827ef9b4 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:22:19 +0100 Subject: [PATCH 06/30] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dca0bb4..5331bf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ on: branches: - develop - main - - workflows-improvement paths: - "src/**" - "tests/**" From 576d8d276890b42a3b79d88bf5ee762010d0f4e2 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:29:00 +0100 Subject: [PATCH 07/30] allure url message --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5331bf5..be9e773 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,3 +94,20 @@ jobs: publish_dir: ./allure-report keep_files: false force_orphan: false + + - name: Comment PR with Allure Report URL + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const owner = context.repo.owner; + const repo = context.repo.repo; + const reportUrl = `https://${owner}.github.io/${repo}/`; + const body = `πŸ“Š **Test Report Ready**\n\nβœ… View detailed Allure test report with module-wise results, failures, coverage trends, and build durations:\n\nπŸ”— [**Open Allure Report**](${reportUrl})\n\n---\n*Report includes: Test Suites, Failures, Coverage Trends, Execution Timeline, and Module-wise Breakdown.*`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }); From e255acf21ccc0a8afb3d6870ddba7d9e99066a68 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:33:02 +0100 Subject: [PATCH 08/30] message update --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be9e773..ad63718 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: const owner = context.repo.owner; const repo = context.repo.repo; const reportUrl = `https://${owner}.github.io/${repo}/`; - const body = `πŸ“Š **Test Report Ready**\n\nβœ… View detailed Allure test report with module-wise results, failures, coverage trends, and build durations:\n\nπŸ”— [**Open Allure Report**](${reportUrl})\n\n---\n*Report includes: Test Suites, Failures, Coverage Trends, Execution Timeline, and Module-wise Breakdown.*`; + const body = `πŸ“Š **Test Report Ready**\n\nView detailed Allure test report with module-wise results, failures, coverage trends, and build durations:\n\nπŸ”— [**Open Allure Report**](${reportUrl})\n\n*Report includes: Test Suites, Failures, Coverage Trends, Execution Timeline, and Module-wise Breakdown.*`; github.rest.issues.createComment({ issue_number: context.issue.number, From 7ce26da36d710eea1bc11695a4024fd93f8f09e8 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:42:04 +0100 Subject: [PATCH 09/30] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad63718..733f63b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: const owner = context.repo.owner; const repo = context.repo.repo; const reportUrl = `https://${owner}.github.io/${repo}/`; - const body = `πŸ“Š **Test Report Ready**\n\nView detailed Allure test report with module-wise results, failures, coverage trends, and build durations:\n\nπŸ”— [**Open Allure Report**](${reportUrl})\n\n*Report includes: Test Suites, Failures, Coverage Trends, Execution Timeline, and Module-wise Breakdown.*`; + const body = `## πŸ“Š Test Report Generated\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; github.rest.issues.createComment({ issue_number: context.issue.number, From 35fd8e57978f99808eb4db60efddf37cac77758e Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:44:25 +0100 Subject: [PATCH 10/30] wrong test --- tests/e2e/test_contacts_e2e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/test_contacts_e2e.py b/tests/e2e/test_contacts_e2e.py index 8ed9a52..a6b2a6f 100644 --- a/tests/e2e/test_contacts_e2e.py +++ b/tests/e2e/test_contacts_e2e.py @@ -33,7 +33,7 @@ def test_create_and_retrieve_contact(mock_api_client, contacts): # Ensure API calls were made as expected mock_api_client.request.assert_any_call("POST", "/contacts", json=contact_payload) - mock_api_client.request.assert_any_call("GET", "/contacts/contact123") + mock_api_client.request.assert_any_call("GET", "/contacts/contact12") @pytest.mark.e2e From 8fa2fae9c19aa0a2f46694cf14f67a5f80e0e6c2 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 21:50:36 +0100 Subject: [PATCH 11/30] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 733f63b..a4e36f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,13 +86,13 @@ jobs: junitxml-path: ./pytest.xml - name: Deploy Allure Report to GitHub Pages branch - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'pull_request' uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_branch: allure-report publish_dir: ./allure-report - keep_files: false + keep_files: true force_orphan: false - name: Comment PR with Allure Report URL From 6d5abb8166c24d592cc742ce397edfa2678325d0 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 22:00:56 +0100 Subject: [PATCH 12/30] run always --- .github/workflows/ci.yml | 46 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4e36f7..393e9c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,7 @@ name: CI - Code Testing Workflow on: pull_request: + types: [opened, synchronize, reopened, ready_for_review] branches: - develop - main @@ -23,6 +24,9 @@ on: jobs: test: name: Run Tests and Post Coverage + concurrency: + group: allure-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true runs-on: ubuntu-latest permissions: contents: write @@ -62,6 +66,7 @@ jobs: pytest --junitxml=pytest.xml - name: Pull previous Allure history (if exists) + if: always() run: | git fetch origin allure-report || true if git ls-remote --exit-code origin allure-report; then @@ -71,22 +76,16 @@ jobs: cp -r history/* allure-results/history/ || true fi fi - continue-on-error: true - name: Generate Allure Report + if: always() run: | - allure generate allure-results -o allure-report --clean - if [ -d allure-report/history ]; then ls -R allure-report/history | head -n 20; fi - - - name: Pytest coverage comment (PR only) - if: github.event_name == 'pull_request' - uses: MishaKav/pytest-coverage-comment@main - with: - pytest-coverage-path: ./coverage.txt - junitxml-path: ./pytest.xml + allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" + # Ensure GitHub Pages doesn’t run Jekyll (can hide assets) + touch allure-report/.nojekyll - name: Deploy Allure Report to GitHub Pages branch - if: github.event_name == 'push' || github.event_name == 'pull_request' + if: always() uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -94,6 +93,7 @@ jobs: publish_dir: ./allure-report keep_files: true force_orphan: false + commit_message: "docs(allure): update report for ${{ github.sha }} (run ${{ github.run_number }})" - name: Comment PR with Allure Report URL if: github.event_name == 'pull_request' @@ -102,12 +102,20 @@ jobs: script: | const owner = context.repo.owner; const repo = context.repo.repo; - const reportUrl = `https://${owner}.github.io/${repo}/`; - const body = `## πŸ“Š Test Report Generated\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: body + const bust = `${context.runNumber}`; + const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; + const body = `## πŸ“Š Test Report Updated + +**[Open Allure Dashboard β†’](${reportUrl})** + +Coverage β€’ Modules β€’ Failures β€’ Timeline`; + const { data: comments } = await github.rest.issues.listComments({ + owner, repo, issue_number: context.issue.number }); + const marker = 'πŸ“Š Test Report'; + const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(marker)); + if (existing) { + await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body }); + } else { + await github.rest.issues.createComment({ owner, repo, issue_number: context.issue.number, body }); + } From 9547244a3fd826c6d43c4989abfe4497d924fe3d Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 22:02:46 +0100 Subject: [PATCH 13/30] Update ci.yml --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 393e9c8..8f0670f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,11 +104,7 @@ jobs: const repo = context.repo.repo; const bust = `${context.runNumber}`; const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; - const body = `## πŸ“Š Test Report Updated - -**[Open Allure Dashboard β†’](${reportUrl})** - -Coverage β€’ Modules β€’ Failures β€’ Timeline`; + const body = `## πŸ“Š Test Report Generated\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: context.issue.number }); From 1b830db591d7108dd5a62d62327e007f18f0d455 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 22:05:48 +0100 Subject: [PATCH 14/30] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f0670f..40f8784 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,8 +62,9 @@ jobs: run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results > coverage.txt + --alluredir=allure-results > coverage.txt 2>&1 pytest --junitxml=pytest.xml + continue-on-error: true - name: Pull previous Allure history (if exists) if: always() From 74f655f1054ba72e86c9da34f2bde7b512b1e4d0 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 22:27:03 +0100 Subject: [PATCH 15/30] Update ci.yml --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40f8784..c0b454a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,10 +62,16 @@ jobs: run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results > coverage.txt 2>&1 - pytest --junitxml=pytest.xml + --alluredir=allure-results --tb=short + echo "Exit code: $?" continue-on-error: true + - name: Generate JUnit XML + if: always() + run: | + source venv/bin/activate + pytest --junitxml=pytest.xml --tb=short || true + - name: Pull previous Allure history (if exists) if: always() run: | From d8705552b60ccdb697644e79bf687f97fddb22b0 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sat, 8 Nov 2025 22:36:35 +0100 Subject: [PATCH 16/30] Update ci.yml --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0b454a..4e9a741 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,8 +62,7 @@ jobs: run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results --tb=short - echo "Exit code: $?" + --alluredir=allure-results --tb=short || true continue-on-error: true - name: Generate JUnit XML @@ -88,7 +87,6 @@ jobs: if: always() run: | allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" - # Ensure GitHub Pages doesn’t run Jekyll (can hide assets) touch allure-report/.nojekyll - name: Deploy Allure Report to GitHub Pages branch From c3bb3a3d04f367bb0d8c9b19c096409b3618e973 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 01:38:47 +0100 Subject: [PATCH 17/30] Update ci.yml --- .github/workflows/ci.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e9a741..99bec4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: BASE_URL: ${{ secrets.BASE_URL }} API_KEY: ${{ secrets.API_KEY }} WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} + steps: - name: Checkout code uses: actions/checkout@v3 @@ -58,13 +59,19 @@ jobs: pip install -r requirements.txt npm install -g allure-commandline + # ------------------------------- + # Run tests normally (don't ignore failures) + # ------------------------------- - name: Run tests (coverage + allure results) + id: run_tests run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results --tb=short || true - continue-on-error: true + --alluredir=allure-results --tb=short || echo "exit_code=$?" >> $GITHUB_OUTPUT + # ------------------------------- + # Always generate reports (even if tests failed) + # ------------------------------- - name: Generate JUnit XML if: always() run: | @@ -120,3 +127,10 @@ jobs: } else { await github.rest.issues.createComment({ owner, repo, issue_number: context.issue.number, body }); } + + # ------------------------------- + # Explicitly fail job if tests failed + # ------------------------------- + - name: Fail job if tests failed + if: ${{ steps.run_tests.outputs.exit_code != '' && steps.run_tests.outputs.exit_code != '0' }} + run: exit 1 From 9eb0dcf8515974329827f88f4981a41254a96fae Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 01:43:28 +0100 Subject: [PATCH 18/30] Update ci.yml --- .github/workflows/ci.yml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99bec4f..51d8bb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,25 +59,21 @@ jobs: pip install -r requirements.txt npm install -g allure-commandline - # ------------------------------- - # Run tests normally (don't ignore failures) - # ------------------------------- + # ------------------------------------------------- + # Run tests, capture exit code (so report still runs) + # ------------------------------------------------- - name: Run tests (coverage + allure results) id: run_tests run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results --tb=short || echo "exit_code=$?" >> $GITHUB_OUTPUT - - # ------------------------------- - # Always generate reports (even if tests failed) - # ------------------------------- - - name: Generate JUnit XML - if: always() - run: | - source venv/bin/activate - pytest --junitxml=pytest.xml --tb=short || true + --alluredir=allure-results --tb=short + echo "exit_code=$?" >> $GITHUB_OUTPUT || echo "exit_code=0" >> $GITHUB_OUTPUT + continue-on-error: true # let next steps execute even if pytest fails + # ------------------------------------------------- + # Generate report and coverage regardless of status + # ------------------------------------------------- - name: Pull previous Allure history (if exists) if: always() run: | @@ -128,9 +124,9 @@ jobs: await github.rest.issues.createComment({ owner, repo, issue_number: context.issue.number, body }); } - # ------------------------------- - # Explicitly fail job if tests failed - # ------------------------------- + # ------------------------------------------------- + # Explicitly fail job if pytest exit code != 0 + # ------------------------------------------------- - name: Fail job if tests failed - if: ${{ steps.run_tests.outputs.exit_code != '' && steps.run_tests.outputs.exit_code != '0' }} + if: ${{ steps.run_tests.outcome == 'failure' }} run: exit 1 From 2fd40080520a11c7e7de99f3d5a9b77fd9ee499b Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 01:47:10 +0100 Subject: [PATCH 19/30] Update ci.yml --- .github/workflows/ci.yml | 81 +++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51d8bb1..4666063 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,19 +22,13 @@ on: - ".github/workflows/**" jobs: - test: - name: Run Tests and Post Coverage - concurrency: - group: allure-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + tests: + name: πŸ§ͺ Run Tests and Collect Results runs-on: ubuntu-latest permissions: - contents: write - pull-requests: write - env: - BASE_URL: ${{ secrets.BASE_URL }} - API_KEY: ${{ secrets.API_KEY }} - WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} + contents: read + outputs: + test_outcome: ${{ steps.run_tests.outcome }} steps: - name: Checkout code @@ -45,11 +39,6 @@ jobs: with: python-version: "3.9" - - name: Set up Node (for Allure CLI) - uses: actions/setup-node@v4 - with: - node-version: "18" - - name: Install dependencies run: | python -m venv venv @@ -57,25 +46,48 @@ jobs: pip install --upgrade pip pip install pytest pytest-cov allure-pytest pip install -r requirements.txt - npm install -g allure-commandline - # ------------------------------------------------- - # Run tests, capture exit code (so report still runs) - # ------------------------------------------------- - - name: Run tests (coverage + allure results) + - name: Run tests id: run_tests + continue-on-error: true run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ --alluredir=allure-results --tb=short - echo "exit_code=$?" >> $GITHUB_OUTPUT || echo "exit_code=0" >> $GITHUB_OUTPUT - continue-on-error: true # let next steps execute even if pytest fails + echo "exit_code=$?" >> $GITHUB_OUTPUT - # ------------------------------------------------- - # Generate report and coverage regardless of status - # ------------------------------------------------- - - name: Pull previous Allure history (if exists) + - name: Upload allure-results artifact if: always() + uses: actions/upload-artifact@v4 + with: + name: allure-results + path: allure-results + + report: + name: πŸ“Š Generate and Publish Allure Report + runs-on: ubuntu-latest + needs: tests + if: always() # run even if tests failed + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "18" + + - name: Download allure-results artifact + uses: actions/download-artifact@v4 + with: + name: allure-results + path: allure-results + + - name: Pull previous Allure history (if exists) run: | git fetch origin allure-report || true if git ls-remote --exit-code origin allure-report; then @@ -87,13 +99,12 @@ jobs: fi - name: Generate Allure Report - if: always() run: | + npm install -g allure-commandline allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" touch allure-report/.nojekyll - - name: Deploy Allure Report to GitHub Pages branch - if: always() + - name: Deploy Allure Report to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -112,7 +123,8 @@ jobs: const repo = context.repo.repo; const bust = `${context.runNumber}`; const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; - const body = `## πŸ“Š Test Report Generated\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; + const outcome = "${{ needs.tests.result }}" === "success" ? "βœ… Tests Passed" : "❌ Tests Failed"; + const body = `## ${outcome}\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: context.issue.number }); @@ -123,10 +135,3 @@ jobs: } else { await github.rest.issues.createComment({ owner, repo, issue_number: context.issue.number, body }); } - - # ------------------------------------------------- - # Explicitly fail job if pytest exit code != 0 - # ------------------------------------------------- - - name: Fail job if tests failed - if: ${{ steps.run_tests.outcome == 'failure' }} - run: exit 1 From fadf5debf9b5a88f9ef90273d0219c932a33c9f4 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 01:52:34 +0100 Subject: [PATCH 20/30] Update ci.yml --- .github/workflows/ci.yml | 76 ++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4666063..9ae9170 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,13 +22,19 @@ on: - ".github/workflows/**" jobs: - tests: - name: πŸ§ͺ Run Tests and Collect Results + test: + name: Run Tests and Post Coverage + concurrency: + group: allure-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true runs-on: ubuntu-latest permissions: - contents: read - outputs: - test_outcome: ${{ steps.run_tests.outcome }} + contents: write + pull-requests: write + env: + BASE_URL: ${{ secrets.BASE_URL }} + API_KEY: ${{ secrets.API_KEY }} + WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} steps: - name: Checkout code @@ -39,6 +45,11 @@ jobs: with: python-version: "3.9" + - name: Set up Node (for Allure CLI) + uses: actions/setup-node@v4 + with: + node-version: "18" + - name: Install dependencies run: | python -m venv venv @@ -46,48 +57,18 @@ jobs: pip install --upgrade pip pip install pytest pytest-cov allure-pytest pip install -r requirements.txt + npm install -g allure-commandline - - name: Run tests + - name: Run tests (coverage + allure results) id: run_tests - continue-on-error: true run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results --tb=short - echo "exit_code=$?" >> $GITHUB_OUTPUT - - - name: Upload allure-results artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: allure-results - path: allure-results - - report: - name: πŸ“Š Generate and Publish Allure Report - runs-on: ubuntu-latest - needs: tests - if: always() # run even if tests failed - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: "18" - - - name: Download allure-results artifact - uses: actions/download-artifact@v4 - with: - name: allure-results - path: allure-results + --alluredir=allure-results --tb=short || echo "TESTS_FAILED=true" >> $GITHUB_ENV + continue-on-error: true - name: Pull previous Allure history (if exists) + if: always() run: | git fetch origin allure-report || true if git ls-remote --exit-code origin allure-report; then @@ -99,12 +80,13 @@ jobs: fi - name: Generate Allure Report + if: always() run: | - npm install -g allure-commandline allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" touch allure-report/.nojekyll - - name: Deploy Allure Report to GitHub Pages + - name: Deploy Allure Report to GitHub Pages branch + if: always() uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -115,7 +97,7 @@ jobs: commit_message: "docs(allure): update report for ${{ github.sha }} (run ${{ github.run_number }})" - name: Comment PR with Allure Report URL - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' && always() uses: actions/github-script@v7 with: script: | @@ -123,8 +105,8 @@ jobs: const repo = context.repo.repo; const bust = `${context.runNumber}`; const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; - const outcome = "${{ needs.tests.result }}" === "success" ? "βœ… Tests Passed" : "❌ Tests Failed"; - const body = `## ${outcome}\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; + const testStatus = process.env.TESTS_FAILED === 'true' ? '⚠️ (1 test failed)' : 'βœ…'; + const body = `## πŸ“Š Test Report ${testStatus}\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: context.issue.number }); @@ -135,3 +117,7 @@ jobs: } else { await github.rest.issues.createComment({ owner, repo, issue_number: context.issue.number, body }); } + + - name: Fail job if tests failed + if: env.TESTS_FAILED == 'true' + run: exit 1 From 36ca6beafdd7804de9bfa8b7ffdc5bec9f164a0c Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:02:27 +0100 Subject: [PATCH 21/30] more error --- tests/integration/sdk/test_contacts_integration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/sdk/test_contacts_integration.py b/tests/integration/sdk/test_contacts_integration.py index 327661f..f2f4046 100644 --- a/tests/integration/sdk/test_contacts_integration.py +++ b/tests/integration/sdk/test_contacts_integration.py @@ -67,7 +67,7 @@ def test_list_contacts_success(contacts, mock_api_client): # Assertions mock_api_client.request.assert_called_once_with("GET", "/contacts", params={"pageIndex": 1, "max": 2}) assert len(response["contactsList"]) == 2 - assert response["contactsList"][0]["id"] == "123" + assert response["contactsList"][0]["id"] == "12" def test_get_contact_success(contacts, mock_api_client): @@ -82,7 +82,7 @@ def test_get_contact_success(contacts, mock_api_client): # Assertions mock_api_client.request.assert_called_once_with("GET", f"/contacts/{contact_id}") assert response["id"] == "123" - assert response["name"] == "John Doe" + assert response["name"] == "John Do" def test_get_contact_not_found(contacts, mock_api_client): From bd5c5977a5b41d1396c9db39bfd58ee6287c8fa2 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:10:42 +0100 Subject: [PATCH 22/30] Update test_contacts_integration.py --- tests/integration/sdk/test_contacts_integration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/sdk/test_contacts_integration.py b/tests/integration/sdk/test_contacts_integration.py index f2f4046..327661f 100644 --- a/tests/integration/sdk/test_contacts_integration.py +++ b/tests/integration/sdk/test_contacts_integration.py @@ -67,7 +67,7 @@ def test_list_contacts_success(contacts, mock_api_client): # Assertions mock_api_client.request.assert_called_once_with("GET", "/contacts", params={"pageIndex": 1, "max": 2}) assert len(response["contactsList"]) == 2 - assert response["contactsList"][0]["id"] == "12" + assert response["contactsList"][0]["id"] == "123" def test_get_contact_success(contacts, mock_api_client): @@ -82,7 +82,7 @@ def test_get_contact_success(contacts, mock_api_client): # Assertions mock_api_client.request.assert_called_once_with("GET", f"/contacts/{contact_id}") assert response["id"] == "123" - assert response["name"] == "John Do" + assert response["name"] == "John Doe" def test_get_contact_not_found(contacts, mock_api_client): From d0fa379589bdf598fe82f955951911c5b9beb1bc Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:19:33 +0100 Subject: [PATCH 23/30] Update Allure report build info and fix test assertion Appends build run number as an HTML comment to the Allure report index in the CI workflow. Also corrects the expected contact ID in the e2e test assertion from 'contact12' to 'contact123'. --- .github/workflows/ci.yml | 1 + tests/e2e/test_contacts_e2e.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ae9170..97ba28a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,7 @@ jobs: if: always() run: | allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" + echo "" >> allure-report/index.html touch allure-report/.nojekyll - name: Deploy Allure Report to GitHub Pages branch diff --git a/tests/e2e/test_contacts_e2e.py b/tests/e2e/test_contacts_e2e.py index a6b2a6f..8ed9a52 100644 --- a/tests/e2e/test_contacts_e2e.py +++ b/tests/e2e/test_contacts_e2e.py @@ -33,7 +33,7 @@ def test_create_and_retrieve_contact(mock_api_client, contacts): # Ensure API calls were made as expected mock_api_client.request.assert_any_call("POST", "/contacts", json=contact_payload) - mock_api_client.request.assert_any_call("GET", "/contacts/contact12") + mock_api_client.request.assert_any_call("GET", "/contacts/contact123") @pytest.mark.e2e From 043b55a6cbd3f063234d766ae27d55ba232aa772 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:23:52 +0100 Subject: [PATCH 24/30] Update test_contacts_e2e.py --- tests/e2e/test_contacts_e2e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/test_contacts_e2e.py b/tests/e2e/test_contacts_e2e.py index 8ed9a52..a6b2a6f 100644 --- a/tests/e2e/test_contacts_e2e.py +++ b/tests/e2e/test_contacts_e2e.py @@ -33,7 +33,7 @@ def test_create_and_retrieve_contact(mock_api_client, contacts): # Ensure API calls were made as expected mock_api_client.request.assert_any_call("POST", "/contacts", json=contact_payload) - mock_api_client.request.assert_any_call("GET", "/contacts/contact123") + mock_api_client.request.assert_any_call("GET", "/contacts/contact12") @pytest.mark.e2e From 600e5882d9bce495d3378c89015342df146014e7 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:32:09 +0100 Subject: [PATCH 25/30] Update ci.yml --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97ba28a..211e68a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,6 +85,15 @@ jobs: allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" echo "" >> allure-report/index.html touch allure-report/.nojekyll + + - name: Add cache-busting marker file + if: always() + run: | + echo "run-${{ github.run_number }}-$(date +%s)" > allure-report/build_version.txt + + - name: Wait for filesystem sync + if: always() + run: sleep 3 - name: Deploy Allure Report to GitHub Pages branch if: always() From 0a8d26b85dbd11f7e6bdeada53ba72766e31093f Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:34:32 +0100 Subject: [PATCH 26/30] Update test_contacts_e2e.py --- tests/e2e/test_contacts_e2e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/test_contacts_e2e.py b/tests/e2e/test_contacts_e2e.py index a6b2a6f..8ed9a52 100644 --- a/tests/e2e/test_contacts_e2e.py +++ b/tests/e2e/test_contacts_e2e.py @@ -33,7 +33,7 @@ def test_create_and_retrieve_contact(mock_api_client, contacts): # Ensure API calls were made as expected mock_api_client.request.assert_any_call("POST", "/contacts", json=contact_payload) - mock_api_client.request.assert_any_call("GET", "/contacts/contact12") + mock_api_client.request.assert_any_call("GET", "/contacts/contact123") @pytest.mark.e2e From db54f8e8e6e5880bb322a38d9d4c167ce19e1e5f Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:47:53 +0100 Subject: [PATCH 27/30] Update ci.yml --- .github/workflows/ci.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 211e68a..1e9554e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,15 +85,6 @@ jobs: allure generate allure-results -o allure-report --clean || echo "No allure-results to generate" echo "" >> allure-report/index.html touch allure-report/.nojekyll - - - name: Add cache-busting marker file - if: always() - run: | - echo "run-${{ github.run_number }}-$(date +%s)" > allure-report/build_version.txt - - - name: Wait for filesystem sync - if: always() - run: sleep 3 - name: Deploy Allure Report to GitHub Pages branch if: always() @@ -116,7 +107,7 @@ jobs: const bust = `${context.runNumber}`; const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; const testStatus = process.env.TESTS_FAILED === 'true' ? '⚠️ (1 test failed)' : 'βœ…'; - const body = `## πŸ“Š Test Report ${testStatus}\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline`; + const body = `## πŸ“Š Test Report ${testStatus}\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline\n\n⚠️NB: Use hard reload (Cmd + Shift + R on Mac), or use incognito mode if the changes doesn't appear in the dashboard`; const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: context.issue.number }); From 297fe202373da1b08978e6b0b2767d2363a9956b Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:57:36 +0100 Subject: [PATCH 28/30] Update ci.yml --- .github/workflows/ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e9554e..37a5639 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,9 +64,16 @@ jobs: run: | source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ - --alluredir=allure-results --tb=short || echo "TESTS_FAILED=true" >> $GITHUB_ENV + --alluredir=allure-results --tb=short > coverage.txt 2>&1 || echo "TESTS_FAILED=true" >> $GITHUB_ENV continue-on-error: true + - name: Pytest coverage comment + if: github.event_name == 'pull_request' && always() + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./coverage.txt + junitxml-path: ./pytest.xml + - name: Pull previous Allure history (if exists) if: always() run: | @@ -107,7 +114,8 @@ jobs: const bust = `${context.runNumber}`; const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; const testStatus = process.env.TESTS_FAILED === 'true' ? '⚠️ (1 test failed)' : 'βœ…'; - const body = `## πŸ“Š Test Report ${testStatus}\n\n**[View Allure Dashboard β†’](${reportUrl})**\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline\n\n⚠️NB: Use hard reload (Cmd + Shift + R on Mac), or use incognito mode if the changes doesn't appear in the dashboard`; + const body = `## πŸ“Š Test Report ${testStatus}\n\n[![View Allure Dashboard](https://img.shields.io/badge/View%20Dashboard-1A73E8?style=for-the-badge&logo=google-chrome&logoColor=white)](${reportUrl})\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline\n\n ⚠️ NB: If the dashboard doesn't update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.`; + const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: context.issue.number }); From 6f3069e7a4e58f8db5c3f9831bb11655db608ea2 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 02:57:46 +0100 Subject: [PATCH 29/30] Update test_contacts_e2e.py --- tests/e2e/test_contacts_e2e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/test_contacts_e2e.py b/tests/e2e/test_contacts_e2e.py index 8ed9a52..a6b2a6f 100644 --- a/tests/e2e/test_contacts_e2e.py +++ b/tests/e2e/test_contacts_e2e.py @@ -33,7 +33,7 @@ def test_create_and_retrieve_contact(mock_api_client, contacts): # Ensure API calls were made as expected mock_api_client.request.assert_any_call("POST", "/contacts", json=contact_payload) - mock_api_client.request.assert_any_call("GET", "/contacts/contact123") + mock_api_client.request.assert_any_call("GET", "/contacts/contact12") @pytest.mark.e2e From 49920ec3f2344d80908f06d4e508b904e66def74 Mon Sep 17 00:00:00 2001 From: Amirul Islam Date: Sun, 9 Nov 2025 03:06:09 +0100 Subject: [PATCH 30/30] Update ci.yml --- .github/workflows/ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37a5639..ab8611a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,6 +65,7 @@ jobs: source venv/bin/activate pytest --cov=src --cov-report=xml --cov-report=term \ --alluredir=allure-results --tb=short > coverage.txt 2>&1 || echo "TESTS_FAILED=true" >> $GITHUB_ENV + pytest --junitxml=pytest.xml continue-on-error: true - name: Pytest coverage comment @@ -113,8 +114,19 @@ jobs: const repo = context.repo.repo; const bust = `${context.runNumber}`; const reportUrl = `https://${owner}.github.io/${repo}/?run=${bust}`; - const testStatus = process.env.TESTS_FAILED === 'true' ? '⚠️ (1 test failed)' : 'βœ…'; - const body = `## πŸ“Š Test Report ${testStatus}\n\n[![View Allure Dashboard](https://img.shields.io/badge/View%20Dashboard-1A73E8?style=for-the-badge&logo=google-chrome&logoColor=white)](${reportUrl})\n\nCoverage trends β€’ Module breakdown β€’ Failure analysis β€’ Execution timeline\n\n ⚠️ NB: If the dashboard doesn't update immediately, try a hard reload (Cmd + Shift + R on Mac) or open in incognito mode.`; + + // Determine test result color and icon + const testsFailed = process.env.TESTS_FAILED === 'true'; + const badgeColor = testsFailed ? 'E63946' : '2EA44F'; // red : green + const testStatus = testsFailed ? '⚠️ (Some tests failed)' : 'βœ… All tests passed'; + + 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 { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: context.issue.number