-
Notifications
You must be signed in to change notification settings - Fork 9
198 lines (176 loc) · 6.44 KB
/
Copy pathci.yml
File metadata and controls
198 lines (176 loc) · 6.44 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Selenium Test Framework
on:
workflow_dispatch:
pull_request:
branches:
- master
- fb_*
push:
branches:
- master
- fb_*
schedule:
- cron: '0 0 * * *'
jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
browser: [ chrome, firefox, msedge ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Cache Maven
uses: actions/cache@v4
with:
path: |
~/.m2/repository
target
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: Build Project
run: |
mvn -B install -DskipTests --no-transfer-progress -T 4C
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
- name: Install Firefox
uses: browser-actions/setup-firefox@latest
- name: Install Edge
uses: browser-actions/setup-edge@v1
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.browser }} # Unique artifact name
path: |
${{ github.workspace }}/target
${{ github.workspace }}/reports
smoke_tests:
name: Run Smoke Tests
runs-on: ubuntu-latest
needs: build_and_test
strategy:
matrix:
browser: [ chrome, firefox, msedge ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.browser }} # Match the unique artifact name
- name: Run Tests for ${{ matrix.browser }}
run: |
mvn clean test -Drunmode=headless -Dbrowser=${{ matrix.browser }} \
-Dgroups=SAUCE_LABS_SMOKE \
-Dthreads=3 -Ddataproviderthreadcount=3
- name: Verify Report Directory
run: ls target/surefire-reports || echo "Report directory not found"
- name: Generate Test Summary
uses: test-summary/action@v2
id: summary
with:
paths: "target/surefire-reports/TEST-*.xml"
if: always()
- name: Send Results to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
# Gather metrics from test-summary output
passed="${{ steps.summary.outputs.passed }}"
failed="${{ steps.summary.outputs.failed }}"
skipped="${{ steps.summary.outputs.skipped }}"
total="${{ steps.summary.outputs.total }}"
pass_percentage=$(awk "BEGIN {print ($passed/$total)*100}")
fail_percentage=$(awk "BEGIN {print ($failed/$total)*100}")
content="-----------------------------------\n\n"
content+="🛠️ **Job: ${{ github.job }}**\n"
content+="👤 **User: ${{ github.actor }}**\n"
content+="🌎 **Browser: ${{ matrix.browser }}**\n"
content+="🎉 **Passed**: ${passed}\n"
content+="❌ **Failed**: ${failed}\n"
content+="⚠️ **Skipped**: ${skipped}\n"
content+="📊 **Total**: ${total}\n\n"
content+="✅ **Pass %**: ${pass_percentage}%\n"
content+="❌ **Fail %**: ${fail_percentage}%\n\n"
content+="-----------------------------------\n\n"
curl --location "$DISCORD_WEBHOOK_URL" \
--header 'Content-Type: application/json' \
--data-raw "{
\"content\": \"$content\",
\"username\": \"TestBot\"
}"
regression_tests:
name: Run Regression Tests
runs-on: ubuntu-latest
needs: build_and_test
strategy:
matrix:
browser: [ chrome, firefox, msedge ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.browser }} # Match the unique artifact name
- name: Run Tests for ${{ matrix.browser }}
run: |
mvn clean test -Drunmode=headless -Dbrowser=${{ matrix.browser }} \
-Dgroups=SAUCE_LABS_REGRESSION \
-Dthreads=3 -Ddataproviderthreadcount=3
- name: Verify Report Directory
run: ls target/surefire-reports || echo "Report directory not found"
- name: Generate Test Summary
uses: test-summary/action@v2
id: summary
with:
paths: "target/surefire-reports/TEST-*.xml"
if: always()
- name: Send Results to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
# Gather metrics from test-summary output
passed="${{ steps.summary.outputs.passed }}"
failed="${{ steps.summary.outputs.failed }}"
skipped="${{ steps.summary.outputs.skipped }}"
total="${{ steps.summary.outputs.total }}"
pass_percentage=$(awk "BEGIN {print ($passed/$total)*100}")
fail_percentage=$(awk "BEGIN {print ($failed/$total)*100}")
content="-----------------------------------\n\n"
content+="🛠️ **Job: ${{ github.job }}**\n"
content+="👤 **User: ${{ github.actor }}**\n"
content+="🌎 **Browser: ${{ matrix.browser }}**\n"
content+="🎉 **Passed**: ${passed}\n"
content+="❌ **Failed**: ${failed}\n"
content+="⚠️ **Skipped**: ${skipped}\n"
content+="📊 **Total**: ${total}\n\n"
content+="✅ **Pass %**: ${pass_percentage}%\n"
content+="❌ **Fail %**: ${fail_percentage}%\n\n"
content+="-----------------------------------\n\n"
curl --location "$DISCORD_WEBHOOK_URL" \
--header 'Content-Type: application/json' \
--data-raw "{
\"content\": \"$content\",
\"username\": \"TestBot\"
}"