Skip to content

Commit dac2bf3

Browse files
committed
update pr
1 parent ee537ea commit dac2bf3

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Generate Allure Reports
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
publish-to-pages:
7+
description: 'Publish report to GitHub Pages'
8+
required: false
9+
default: false
10+
type: boolean
11+
workflow_call:
12+
inputs:
13+
publish-to-pages:
14+
required: false
15+
type: boolean
16+
default: false
17+
description: 'Whether to publish report to GitHub Pages'
18+
report-name:
19+
required: false
20+
type: string
21+
default: 'Rocket.Chat E2E Test Report'
22+
description: 'Name for the Allure report'
23+
24+
jobs:
25+
generate-allure-report:
26+
name: 📊 Generate Allure Report
27+
runs-on: ubuntu-24.04
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '20'
37+
cache: 'npm'
38+
39+
- name: Install Allure Commandline
40+
run: |
41+
# Download and install Allure commandline tool
42+
wget https://github.com/allure-framework/allure2/releases/download/2.24.1/allure-2.24.1.tgz
43+
tar -zxf allure-2.24.1.tgz
44+
sudo mv allure-2.24.1 /opt/allure
45+
sudo ln -s /opt/allure/bin/allure /usr/local/bin/allure
46+
allure --version
47+
48+
- name: Download E2E test artifacts
49+
uses: actions/download-artifact@v4
50+
with:
51+
pattern: allure-results-*
52+
path: ./downloaded-artifacts
53+
merge-multiple: true
54+
55+
- name: Extract and combine Allure results
56+
run: |
57+
mkdir -p combined-allure-results
58+
59+
# Extract Allure results from downloaded artifacts
60+
for artifact_dir in ./downloaded-artifacts/*/; do
61+
if [ -d "$artifact_dir" ]; then
62+
echo "Processing artifact: $artifact_dir"
63+
64+
# Look for allure-results in the artifact
65+
if [ -d "$artifact_dir/apps/meteor/allure-results" ]; then
66+
echo "Found Allure results in $artifact_dir"
67+
cp -r "$artifact_dir/apps/meteor/allure-results"/* combined-allure-results/ 2>/dev/null || true
68+
fi
69+
70+
# Also check for results in the root of the artifact
71+
if [ -d "$artifact_dir/allure-results" ]; then
72+
echo "Found Allure results in root of $artifact_dir"
73+
cp -r "$artifact_dir/allure-results"/* combined-allure-results/ 2>/dev/null || true
74+
fi
75+
fi
76+
done
77+
78+
# Count results
79+
result_count=$(find combined-allure-results -name "*.json" | wc -l)
80+
echo "📊 Found $result_count Allure result files"
81+
82+
if [ $result_count -eq 0 ]; then
83+
echo "⚠️ No Allure result files found. Creating empty report."
84+
echo '{"uuid":"empty","name":"No E2E tests executed","status":"skipped","start":'$(date +%s000)',"stop":'$(date +%s000)',"steps":[]}' > combined-allure-results/empty-result.json
85+
fi
86+
87+
- name: Generate Allure Report
88+
run: |
89+
# Create report directory
90+
mkdir -p allure-report
91+
92+
# Generate Allure report from combined results
93+
allure generate combined-allure-results --clean -o allure-report
94+
95+
# Verify report was generated
96+
if [ ! -d "allure-report" ] || [ ! -f "allure-report/index.html" ]; then
97+
echo "❌ Failed to generate Allure report"
98+
exit 1
99+
fi
100+
101+
echo "✅ Allure report generated successfully"
102+
ls -la allure-report/
103+
104+
- name: Upload Allure Report as Artifact
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: allure-e2e-report-${{ github.run_number }}
108+
path: allure-report/
109+
retention-days: 30
110+
111+
- name: Publish to GitHub Pages
112+
if: inputs.publish-to-pages == true || github.event.inputs.publish-to-pages == 'true'
113+
uses: peaceiris/actions-gh-pages@v3
114+
with:
115+
github_token: ${{ secrets.GITHUB_TOKEN }}
116+
publish_dir: ./allure-report
117+
destination_dir: allure-reports/e2e/${{ github.run_number }}
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
121+
- name: Comment PR with Report Link
122+
if: github.event_name == 'pull_request' && (inputs.publish-to-pages == true || github.event.inputs.publish-to-pages == 'true')
123+
uses: actions/github-script@v7
124+
with:
125+
script: |
126+
const reportUrl = `https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/allure-reports/e2e/${{ github.run_number }}`;
127+
const reportName = '${{ inputs.report-name || "Rocket.Chat E2E Test Report" }}';
128+
129+
const comment = `## 📊 ${reportName}
130+
131+
**Allure E2E Test Report:** [View Report](${reportUrl})
132+
133+
This report contains detailed E2E test results, including:
134+
- Test execution summary
135+
- Failed test details with screenshots and traces
136+
- Test trends and history
137+
- Environment information
138+
- Playwright test traces for debugging
139+
140+
---
141+
*E2E Test Report generated for commit: \`${{ github.sha }}\`*`;
142+
143+
github.rest.issues.createComment({
144+
issue_number: context.issue.number,
145+
owner: context.repo.owner,
146+
repo: context.repo.repo,
147+
body: comment
148+
});

0 commit comments

Comments
 (0)