Skip to content

Commit 3d7a34f

Browse files
authored
Merge pull request #213 from nirtal85/allure3
readme
2 parents bb05d49 + bc47d10 commit 3d7a34f

File tree

3 files changed

+116
-95
lines changed

3 files changed

+116
-95
lines changed

.github/workflows/devRun.yml

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ name: Pre merge test
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66
paths:
7-
- '**/*.py'
8-
- '**/*.toml'
9-
- '**/*.lock'
10-
- '.github/workflows/devRun.yml'
7+
- "**/*.py"
8+
- "**/*.toml"
9+
- "**/*.lock"
10+
- ".github/workflows/devRun.yml"
1111

1212
permissions:
13-
contents: write
13+
contents: read
14+
pull-requests: write
15+
checks: write
1416
pages: write
17+
id-token: write
1518

1619
jobs:
1720
merge_test:
@@ -20,11 +23,12 @@ jobs:
2023
container:
2124
image: mcr.microsoft.com/playwright:v1.55.0
2225
steps:
23-
- uses: actions/checkout@v5
26+
- name: Checkout
27+
uses: actions/checkout@v5
2428
- name: Set up Python
2529
uses: actions/setup-python@v6
2630
with:
27-
python-version: '3.13'
31+
python-version: "3.13"
2832
- name: Set up uv
2933
uses: astral-sh/setup-uv@v7
3034
with:
@@ -34,47 +38,59 @@ jobs:
3438
uv venv
3539
uv sync --all-extras --dev
3640
- name: Test with pytest
37-
run: xvfb-run .venv/bin/python -m pytest -m devRun --base-url ${{ vars.BASE_URL }}
41+
run: xvfb-run .venv/bin/python -m pytest -m devRun --base-url ${{ vars.BASE_URL }}
3842
- name: Auto-assign reviewers
3943
uses: kentaro-m/auto-assign-action@v2.0.0
4044
if: success()
4145
- name: Store Playwright Traces and Videos From Failed Tests
4246
if: failure()
43-
uses: actions/upload-artifact@v4.6.2
47+
uses: actions/upload-artifact@v6
4448
id: artifact-upload-step
4549
with:
4650
name: test-results
4751
path: test-results/
4852
retention-days: 7
49-
- name: Link Playwright Traces And Videos To Allure Report
53+
- name: Link Playwright Traces And Videos To Allure Results
5054
working-directory: allure-results
5155
if: failure()
5256
run: echo ARTIFACT_URL=${{ steps.artifact-upload-step.outputs.artifact-url }} >> environment.properties
53-
- name: Link Git Information And Browser Version To Allure Report
54-
working-directory: allure-results
57+
- name: Link Git Information And Browser Version To Allure Results
5558
if: always()
59+
working-directory: allure-results
5660
run: |
5761
{
58-
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
59-
echo GIT_BRANCH=${{ github.head_ref || github.ref_name }}
60-
echo GIT_COMMIT_ID=${{ github.sha }}
61-
echo GIT_COMMIT_MESSAGE=$(git show -s --format=%s HEAD)
62-
echo GIT_COMMIT_AUTHOR_NAME=$(git show -s --format='%ae' HEAD)
63-
echo GIT_COMMIT_TIME=$(git show -s --format=%ci HEAD)
64-
echo CHROME_VERSION=$(google-chrome --product-version)
62+
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
63+
echo GIT_BRANCH=${{ github.head_ref || github.ref_name }}
64+
echo GIT_COMMIT_ID=${{ github.sha }}
65+
echo GIT_COMMIT_MESSAGE="$(git show -s --format=%s HEAD)"
66+
echo GIT_COMMIT_AUTHOR_NAME="$(git show -s --format='%ae' HEAD)"
67+
echo GIT_COMMIT_TIME="$(git show -s --format=%ci HEAD)"
6568
} >> environment.properties
66-
- name: Generate Allure Report
67-
uses: simple-elf/allure-report-action@v1.13
69+
- name: Generate Allure report
70+
if: always()
71+
run: npx -y allure generate allure-results --output allure-report
72+
- name: Allure PR summary
6873
if: always()
69-
id: allure-report
74+
uses: allure-framework/allure-action@v0.6.2
7075
with:
71-
allure_results: allure-results
72-
allure_report: allure-report
73-
gh_pages: gh-pages
74-
allure_history: allure-history
75-
- name: Deploy Report To Github Pages
76+
report-directory: "./allure-report"
77+
github-token: ${{ secrets.GITHUB_TOKEN }}
78+
- name: Upload Pages artifact
7679
if: always()
77-
uses: peaceiris/actions-gh-pages@v4
80+
uses: actions/upload-pages-artifact@v4
7881
with:
79-
github_token: ${{ secrets.GITHUB_TOKEN }}
80-
publish_dir: allure-history
82+
path: allure-report
83+
deploy_pages:
84+
needs: merge_test
85+
if: always()
86+
runs-on: ubuntu-latest
87+
permissions:
88+
pages: write
89+
id-token: write
90+
environment:
91+
name: github-pages
92+
url: ${{ steps.deployment.outputs.page_url }}
93+
steps:
94+
- name: Deploy to GitHub Pages
95+
id: deployment
96+
uses: actions/deploy-pages@v4

.github/workflows/nightly.yml

Lines changed: 67 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ on:
66
workflow_dispatch:
77
inputs:
88
pytest_command:
9-
description: 'Custom pytest command'
9+
description: "Custom pytest command"
1010
required: true
1111
default: '-m "not devRun"'
1212
type: string
1313
parallelism:
14-
description: 'Number of machines to split tests'
14+
description: "Number of machines to split tests"
1515
required: false
1616
default: 2
1717
type: number
1818

1919
permissions:
20-
contents: write
20+
contents: read
2121
pages: write
22+
id-token: write
2223

2324
jobs:
2425
setup-matrix:
@@ -41,11 +42,12 @@ jobs:
4142
fail-fast: false
4243
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
4344
steps:
44-
- uses: actions/checkout@v5
45+
- name: Checkout
46+
uses: actions/checkout@v5
4547
- name: Set up Python
4648
uses: actions/setup-python@v6
4749
with:
48-
python-version: '3.13'
50+
python-version: "3.13"
4951
- name: Set up uv
5052
uses: astral-sh/setup-uv@v7
5153
with:
@@ -55,79 +57,93 @@ jobs:
5557
uv venv
5658
uv sync --all-extras --dev
5759
- name: Run Tests
58-
run: |
59-
xvfb-run .venv/bin/python -m pytest ${{ github.event.inputs.pytest_command || '-m "not devRun"' }} \
60-
--base-url ${{ vars.BASE_URL }} \
61-
--splits ${{ github.event.inputs.parallelism || 2 }} \
62-
--group ${{ matrix.group }}
63-
- name: Upload test results and artifacts
60+
run: >
61+
xvfb-run .venv/bin/python -m pytest
62+
${{ github.event.inputs.pytest_command || '-m "not devRun"' }}
63+
--base-url ${{ vars.BASE_URL }}
64+
--splits ${{ github.event.inputs.parallelism || 2 }}
65+
--group ${{ matrix.group }}
66+
- name: Upload shard test artifacts (test-results + allure-results)
6467
if: always()
65-
uses: actions/upload-artifact@v4.6.2
68+
uses: actions/upload-artifact@v5
6669
with:
67-
name: test-results-${{ matrix.group }}
70+
name: shard-${{ matrix.group }}
6871
path: |
6972
test-results/
70-
allure-results
73+
allure-results/
7174
retention-days: 7
7275

73-
merge-reports:
76+
build-report:
7477
needs: nightly-test
7578
if: always()
7679
runs-on: ubuntu-latest
7780
steps:
78-
- uses: actions/checkout@v5
79-
- name: Download all test results
81+
- name: Checkout
82+
uses: actions/checkout@v5
83+
- name: Download all Allure results into allure-results
84+
if: always()
8085
uses: actions/download-artifact@v5
8186
with:
87+
pattern: shard-*
8288
path: artifacts
83-
- name: Merge test results
89+
merge-multiple: false
90+
- name: Consolidate allure-results
91+
if: always()
92+
run: |
93+
mkdir -p allure-results
94+
find artifacts -type d -name "allure-results" -print0 | while IFS= read -r -d '' d; do
95+
cp -R "$d/." allure-results/
96+
done
97+
- name: Consolidate test-results into merged-test-results
98+
if: always()
8499
run: |
85100
mkdir -p merged-test-results
86-
for dir in artifacts/test-results-*/test-results; do
87-
cp -r $dir/* merged-test-results/
101+
find artifacts -type d -name "test-results" -print0 | while IFS= read -r -d '' d; do
102+
cp -R "$d/." merged-test-results/
88103
done
89-
- name: Upload Merged Test Results
90-
uses: actions/upload-artifact@v4.6.2
104+
- name: Upload merged test-results artifact
105+
if: always()
106+
uses: actions/upload-artifact@v5
91107
id: merged-artifact-upload
92108
with:
93109
name: merged-test-results
94110
path: merged-test-results/
95111
retention-days: 7
96-
- name: Merge Allure Results
97-
run: |
98-
mkdir -p allure-results
99-
for dir in artifacts/test-results-*/allure-results; do
100-
cp -r $dir/* allure-results/
101-
done
102-
- name: Link Git Information And Browser Version To Allure Report
103-
working-directory: allure-results
112+
- name: Link Git Information And Browser Version To Allure Results
104113
if: always()
114+
working-directory: allure-results
105115
run: |
106116
{
107-
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
108-
echo GIT_BRANCH=${{ github.head_ref || github.ref_name }}
109-
echo GIT_COMMIT_ID=${{ github.sha }}
110-
echo GIT_COMMIT_MESSAGE=$(git show -s --format=%s HEAD)
111-
echo GIT_COMMIT_AUTHOR_NAME=$(git show -s --format='%ae' HEAD)
112-
echo GIT_COMMIT_TIME=$(git show -s --format=%ci HEAD)
113-
echo CHROME_VERSION=$(google-chrome --product-version)
117+
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
118+
echo GIT_BRANCH=${{ github.ref_name }}
119+
echo GIT_COMMIT_ID=${{ github.sha }}
120+
echo GIT_COMMIT_MESSAGE="$(git show -s --format=%s HEAD)"
121+
echo GIT_COMMIT_AUTHOR_NAME="$(git show -s --format='%ae' HEAD)"
122+
echo GIT_COMMIT_TIME="$(git show -s --format=%ci HEAD)"
114123
} >> environment.properties
115-
- name: Link Playwright Traces And Videos To Allure Report
124+
- name: Link Playwright Traces And Videos To Allure Results
125+
if: always()
116126
working-directory: allure-results
117-
if: contains(needs.*.result, 'failure')
118127
run: echo ARTIFACT_URL=${{ steps.merged-artifact-upload.outputs.artifact-url }} >> environment.properties
119-
- name: Generate Allure Report
120-
uses: simple-elf/allure-report-action@v1.13
128+
- name: Generate Allure report
121129
if: always()
122-
id: allure-report
123-
with:
124-
allure_results: allure-results
125-
allure_report: allure-report
126-
gh_pages: gh-pages
127-
allure_history: allure-history
128-
- name: Deploy Report To Github Pages
130+
run: npx -y allure generate allure-results --output allure-report
131+
- name: Upload Pages artifact
129132
if: always()
130-
uses: peaceiris/actions-gh-pages@v4
133+
uses: actions/upload-pages-artifact@v4
131134
with:
132-
github_token: ${{ secrets.GITHUB_TOKEN }}
133-
publish_dir: allure-history
135+
path: allure-report
136+
deploy_pages:
137+
needs: build-report
138+
if: always()
139+
runs-on: ubuntu-latest
140+
permissions:
141+
pages: write
142+
id-token: write
143+
environment:
144+
name: github-pages
145+
url: ${{ steps.deployment.outputs.page_url }}
146+
steps:
147+
- name: Deploy to GitHub Pages
148+
id: deployment
149+
uses: actions/deploy-pages@v4

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,10 @@ pytest -m sanity
126126

127127
## 📊 Results, Traces & Debugging
128128

129-
We use Allure for reporting and Playwright Traces for debugging.
130-
131-
Viewing Reports Locally
132-
Windows (via Scoop):
133-
134-
```bash
135-
scoop install allure
136-
allure serve allure-results
137-
```
138-
139-
Mac (via Brew):
129+
We use Allure for reporting. To generate and open the report locally:
140130

141131
```bash
142-
brew install allure
143-
allure serve allure-results
132+
npx -y allure generate allure-results --output allure-report --open
144133
```
145134

146135
👉 [See a Live Example of the Report Here](https://nirtal85.github.io/Playwright-Python-Example/)

0 commit comments

Comments
 (0)