-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 2.36 KB
/
playwright-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Playwright Tests
on:
push:
branches:
- main
schedule:
- cron: '0 14 * * *' # Fixed cron syntax
jobs:
run-tests:
name: Run Playwright Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3 # Updated to v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Create .env file from secrets
run: |
echo "EMAIL=${{ secrets.EMAIL }}" > .env
echo "PASSWORD=${{ secrets.PASS }}" >> .env
- name: Install Dependencies
run: npm ci # Use ci instead of install for more reliable builds
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Install Allure Command-Line Tool
run: npm install -g allure-commandline
- name: Manage Historical Reports
run: |
if [ -d "allure-results" ]; then
find "allure-results" -type f -name "*.json" -delete
fi
REPORTS_DIR="allure-results/history"
mkdir -p "$REPORTS_DIR"
if [ -d ".github/history" ]; then
cp -R ".github/history"/* "$REPORTS_DIR/"
fi
- name: Run Playwright Tests
run: npx playwright test
env:
EMAIL: ${{ secrets.EMAIL }}
PASSWORD: ${{ secrets.PASS }}
- name: Generate Allure Report
if: always()
run: allure generate allure-results --clean -o allure-report
- name: Save historical data
if: always()
run: |
if [ -d "allure-report/history" ]; then
mkdir -p .github/history
cp -R "allure-report/history"/* ".github/history/"
fi
- name: Commit and Push Allure Results and Reports
if: always()
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add .github/history
git commit -m "Update historical Data Allure" || echo "No changes to commit"
git push origin main
- name: Deploy to GitHub Pages
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./allure-report
- name: Upload Artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
retention-days: 30