-
-
Notifications
You must be signed in to change notification settings - Fork 51
223 lines (207 loc) 路 7.82 KB
/
Copy path_test-core-java.yml
File metadata and controls
223 lines (207 loc) 路 7.82 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Common Test workflow for boyka-framework
on:
workflow_call:
inputs:
runs-on:
type: string
description: On which runner to run on
default: ubuntu-latest
java-version:
type: string
description: Version of Java to run on
default: '17'
suite-name:
type: string
description: Test Suite name to run
default: ''
profile-name:
type: string
description: Test Profile Name
default: coverage-test
run-appium:
type: boolean
description: Start Appium server
default: false
emulator-name:
type: string
description: Emulator / Simulator name
default: Pixel_7_Pro
emulator-profile:
type: string
description: Emulator Profile Name
default: pixel_7_pro
emulator-target:
type: string
description: Emulator target image
default: google_apis
emulator-arch:
type: string
description: Emulator target architecture
default: x86_64
emulator-version:
type: number
description: Emulator Target version
default: 34
emulator-channel:
type: string
description: Emulator SDK channel
default: stable
simulator-name:
type: string
description: iOS Simulator Name
default: iPhone 15
simulator-version:
type: number
description: iOS Simulator Name
default: 17.4
run-grid:
type: boolean
description: Start Selenium Grid
default: false
run-ios:
type: boolean
description: Start iOS Simulator
default: false
run-android:
type: boolean
description: Start Android Emulator
default: false
run-web:
type: boolean
description: Start Local Web Browser
default: false
secrets:
cloudUser:
required: false
cloudKey:
required: false
jobs:
test:
runs-on: ${{ inputs.runs-on }}
steps:
- name: Check out Git repository
uses: actions/checkout@v7
- name: Install Java and Maven
uses: actions/setup-java@v5
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: 'maven'
check-latest: true
- name: Install Appium 3.0
if: inputs.run-appium
run: |
if [ "${{ startsWith(inputs.runs-on, 'ubuntu') }}" == "true" ]; then
sudo apt update && sudo apt upgrade
sudo apt install ffmpeg
else
brew install ffmpeg
brew tap wix/brew && brew install wix/brew/applesimutils
fi
npm install -g appium
if [ "${{ inputs.run-android }}" == "true" ]; then
appium driver install uiautomator2
fi
if [ "${{ inputs.run-ios }}" == "true" ]; then
appium driver install xcuitest
fi
if [[ "${{ startsWith(inputs.runs-on, 'macos') }}" == "true" ]] &&
[[ "${{ inputs.run-android }}" == "false" ]] &&
[[ "${{ inputs.run-ios }}" == "false" ]]; then
npx appium driver install mac2
fi
mkdir core-java/logs
appium server --address 127.0.0.1 --port 4724 --use-drivers uiautomator2 --allow-insecure "uiautomator2:get_server_logs","uiautomator2:chromedriver_autodownload" > core-java/logs/appium-android-server.log 2>&1 &
- name: Start Selenium Grid for Web
if: ${{ inputs.run-grid && ! inputs.run-appium }}
run: |
docker compose -f core-java/compose/docker-compose.yml up -d
- name: Launch iOS Simulator
if: ${{ inputs.run-ios }}
uses: futureware-tech/simulator-action@v5
with:
model: ${{ inputs.simulator-name }}
os: 'iOS'
os_version: ${{ inputs.simulator-version }}
shutdown_after_job: true
wait_for_boot: true
erase_before_boot: true
- name: Enable KVM
if: inputs.run-android && startsWith(inputs.runs-on, 'ubuntu')
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: AVD cache
uses: actions/cache@v6
id: avd-cache
if: inputs.run-android
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ inputs.emulator-name }}-${{ inputs.emulator-version }}-${{ inputs.emulator-profile }}-${{ inputs.emulator-arch }}-${{ inputs.emulator-target }}-${{ inputs.emulator-channel }}
- name: Create AVD and generate snapshot for caching
if: inputs.run-android && steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
avd-name: ${{ inputs.emulator-name }}
api-level: ${{ inputs.emulator-version }}
target: ${{ inputs.emulator-target }}
arch: ${{ inputs.emulator-arch }}
profile: ${{ inputs.emulator-profile }}
channel: ${{ inputs.emulator-channel }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: All Test execution
if: ${{ inputs.run-android }}
uses: reactivecircus/android-emulator-runner@v2
with:
avd-name: ${{ inputs.emulator-name }}
api-level: ${{ inputs.emulator-version }}
target: ${{ inputs.emulator-target }}
arch: ${{ inputs.emulator-arch }}
profile: ${{ inputs.emulator-profile }}
channel: ${{ inputs.emulator-channel }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -wipe-data
disable-animations: true
pre-emulator-launch-script: avdmanager list device
script: mvn verify org.jacoco:jacoco-maven-plugin:prepare-agent -f core-java/pom.xml -Dsuite-name=${{ inputs.suite-name }} -Pcoverage-test
- name: All ${{ inputs.suite-name }} Test execution
if: ${{ ! inputs.run-android }}
env:
BS_USER: ${{ secrets.cloudUser }}
BS_KEY: ${{ secrets.cloudKey }}
LT_USER: ${{ secrets.cloudUser }}
LT_KEY: ${{ secrets.cloudKey }}
run: mvn verify org.jacoco:jacoco-maven-plugin:prepare-agent -f core-java/pom.xml -Dsuite-name=${{ inputs.suite-name }} -P${{ inputs.profile-name }}
- name: Stop Selenium Grid for Web
if: ${{ inputs.run-grid && ! inputs.run-appium && always() }}
run: |
docker compose -f core-java/compose/docker-compose.yml down --remove-orphans
- name: Stop Appium Server
if: ${{ inputs.run-appium && always() }}
run: npx kill-port --port 4724
- name: Set Summary Report
run: echo "$(cat ${{ github.workspace }}/core-java/target/failsafe-reports/my-report.md)" >> $GITHUB_STEP_SUMMARY
- name: Upload target folder
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: target-${{ inputs.suite-name }}
retention-days: 1
path: |
${{ github.workspace }}/core-java/target
${{ github.workspace }}/core-java/logs
${{ github.workspace }}/core-java/screenshots
${{ github.workspace }}/core-java/videos
- name: Upload reports folder
uses: actions/upload-artifact@v7
with:
name: reports-${{ inputs.suite-name }}
retention-days: 1
path: |
${{ github.workspace }}/core-java/reports