Skip to content
Open
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
48 changes: 36 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
permissions:
contents: write
pull-requests: write
checks: write
env:
BASE_URL: ${{ secrets.BASE_URL }}
API_KEY: ${{ secrets.API_KEY }}
Expand All @@ -49,6 +50,25 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "18"

- 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

- 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: |
Expand All @@ -57,7 +77,6 @@ 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 (coverage + allure results)
id: run_tests
Expand All @@ -79,22 +98,25 @@ jobs:
run: |
git fetch origin allure-report || true
if git ls-remote --exit-code origin allure-report; then
git checkout origin/allure-report -- history || true
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

- name: Generate Allure Report
if: always()
run: |
allure generate allure-results -o allure-report --clean || echo "No allure-results to generate"
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

- name: Deploy Allure Report to GitHub Pages branch
if: always()
if: always() && hashFiles('allure-report/index.html') != ''
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -119,13 +141,15 @@ jobs:
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 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');

const { data: comments } = await github.rest.issues.listComments({
owner, repo, issue_number: context.issue.number
Expand Down