-
Notifications
You must be signed in to change notification settings - Fork 46
195 lines (170 loc) · 6.27 KB
/
uitests_saucelabs.yaml
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
name: UITest on SauceLabs
on:
workflow_dispatch:
inputs:
device:
required: true
default: 'Pixel8_API33'
type: choice
options:
- 'Pixel8_API33'
- 'Pixel8_API35'
runner:
required: true
default: 'autotestdebug'
type: choice
options:
- 'autotestdebug'
- 'ubuntu-latest'
jobs:
build:
name: build android application for ui tests
runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }}
timeout-minutes: 30
steps:
- name: Print Env Variables
run: env
working-directory: ${{ github.workspace }}
- name: checkout source code of application
uses: actions/checkout@v4
with:
clean: true
path: 'appodeal-android-sdk'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
working-directory: ${{ github.workspace }}/appodeal-android-sdk
run: |
./gradlew updateVersionName -PnewVersion=${{ env.GITHUB_RUN_NUMBER }} || true
./gradlew :banner:assembleDebug
- name: save debug build for Saucelabs
uses: actions/upload-artifact@v4
with:
name: banner-debug.apk
path: appodeal-android-sdk/banner/build/outputs/apk/debug/banner-debug.apk
retention-days: 14
- name: Upload apk to SauceLabs
run: |
curl -u "${{ secrets.SAUCELABS_USERNAME }}:${{ secrets.SAUCELABS_ACCESS_KEY }}" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/v1/storage/upload' \
--form 'payload=@"appodeal-android-sdk/banner/build/outputs/apk/debug/banner-debug.apk"' \
--form 'name="banner-debug.apk"' \
--form 'description="APD demo ${{ env.GITHUB_REF_NAME }} launch by ${{ env.GITHUB_RUN_ID }}"'
tests:
name: run ui tests on SauceLabs with appium
needs: build
runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }}
timeout-minutes: 30
steps:
- name: Print Env Variables
run: env
working-directory: ${{ github.workspace }}
- name: checkout source code of application
uses: actions/checkout@v4
with:
path: 'SDK-Auto-Test'
clean: true
repository: 'appodeal/SDK-Auto-Test'
ref: 'aws'
token: ${{ secrets.UITESTREPOACCESS }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Launch tests on SauceLabs
working-directory: ${{ github.workspace }}/SDK-Auto-Test
run: |
mvn clean
sleep 10
mvn -Dtest=AndroidAppTest test
- name: save Allure result
uses: actions/upload-artifact@v4
if: always()
with:
name: allure-results
path: ${{ github.workspace }}/SDK-Auto-Test/target/allure-results
- name: convert allure-result to allure-report
if: always()
run: allure generate ${{ github.workspace }}/SDK-Auto-Test/target/allure-results --clean -o ${{ github.workspace }}/SDK-Auto-Test/allure-report
- name: save Allure report
uses: actions/upload-artifact@v4
if: always()
with:
name: allure-report
path: ${{ github.workspace }}/SDK-Auto-Test/allure-report
- name: notification to Slack
if: always()
run: |
chmod +x ${{ github.workspace }}/SDK-Auto-Test/allure_notifications/allure-notifications-4.8.0.jar
java "-DconfigFile=${{ github.workspace }}/SDK-Auto-Test/allure_notifications/config.json" -jar ${{ github.workspace }}/SDK-Auto-Test/allure_notifications/allure-notifications-4.8.0.jar
- name: Adding summary
if: ${{ always() }}
run: |
echo "### Results of test execution :fire:" >> $GITHUB_STEP_SUMMARY
echo "Launch: ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
echo "Device: ${{ github.event.inputs.device }}" >> $GITHUB_STEP_SUMMARY
echo "Build agent: ${{ github.event.inputs.runner }}" >> $GITHUB_STEP_SUMMARY
upload:
name: upload allure to gp-pages
needs: tests
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Print Env Variables
run: env
working-directory: ${{ github.workspace }}
- name: Get Allure history
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: download allure results
uses: actions/download-artifact@v4
with:
name: allure-results
path: allure-results
- name: download allure report
uses: actions/download-artifact@v4
with:
name: allure-report
path: allure-report
- name: upload allure-result to gh-pages
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages
allure_report: allure-report
allure_history: allure-history
- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
- name: Post the link to the report
if: always()
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Test report'
state: 'success'
sha: ${{ github.sha }}
target_url: http://appodeal.github.io/appodeal-android-sdk/${{ github.run_number }}
# GITHUB_REF_NAME=feature/auto_test
# GITHUB_RUN_ID=10653731636
# GITHUB_REPOSITORY=appodeal/appodeal-android-sdk
# https://github.com/appodeal/appodeal-android-sdk/actions/runs/10653731636
# GITHUB_TRIGGERING_ACTOR=johnlitvinov
# ${{ env.GITHUB_RUN_ID }}
#
# mvn clean test -DtestEnv=${ENVIRONMENT} -P${SUITE} -Dmaven.repo.local=$MAVEN_LOCAL_REPO -Dstand=${STAND} -Dselenide.browser=${PLATFORM} -Dlocal_run=false
# mvn io.qameta.allure:allure-maven:report -Dmaven.repo.local=$MAVEN_LOCAL_REPO