forked from cucumber/cucumber-jvm-starter-maven-java
-
Notifications
You must be signed in to change notification settings - Fork 2
167 lines (143 loc) · 4.79 KB
/
Copy pathe2e.yml
File metadata and controls
167 lines (143 loc) · 4.79 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
name: E2E tests
on:
workflow_dispatch:
schedule:
- cron: '30 2 * * 1-5' # Monday to Friday at 2:30AM
pull_request:
branches:
- master
jobs:
# Builds the app with QA variant and publish the apk
build_apk:
name: Build APK
runs-on: ubuntu-latest
outputs:
apk-path: ./src/test/resources/owncloud.apk
steps:
- name: Checkout current repo
uses: actions/checkout@v4
- name: Clone external repo
run: git clone https://github.com/owncloud/android.git android-app
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build APK
working-directory: android-app
run: ./gradlew clean assembleqaRelease
- name: Copy APK
id: set-output
run: |
cp ./android-app/owncloudApp/build/outputs/apk/qa/release/owncloud_*-qa-release*.apk ./src/test/resources/owncloud.apk
ls -al ./src/test/resources
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: app-apk
path: ./src/test/resources/owncloud.apk
run_tests:
name: Run Emulator & Execute Tests & Artifacts
needs: build_apk
runs-on: ubuntu-latest
env:
OC_SERVER_URL: ${{ secrets.OC_SERVER_URL }}
BACKEND: oCIS
steps:
- name: Checkout current repo
uses: actions/checkout@v4
# Uploaded in the job above
- name: Download APK
uses: actions/download-artifact@v4
with:
name: app-apk
path: ./src/test/resources
# Improves emulator's performance by using hardware acceleration
- name: Enable KVM
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: Start Appium
run: |
mkdir -p logs video
chmod +x ./runAppium.sh
./runAppium.sh
- name: Enable Cucumber reports
run: |
sed -i 's/^cucumber\.publish\.enabled=false$/cucumber.publish.enabled=true/' ./src/test/resources/cucumber.properties
cat ./src/test/resources/cucumber.properties
- name: Run Emulator & Tests
uses: reactivecircus/android-emulator-runner@v2
id: execution
with:
api-level: 31
target: google_apis
arch: x86_64
profile: pixel
avd-name: test-avd
force-avd-creation: true
disable-animations: true
emulator-options: -no-window -no-audio -no-boot-anim -accel auto -memory 2048
# Ignored tests, no oCIS tests and no CI tests will not run
script: |
# The result of the step will be the one on the left of the pipe
bash -c 'set -o pipefail; ./executeTests -t "not @ignore and not @noocis and not @noci" | tee cucumber_output.txt'
- name: Clean output and create artifact with report
if: always()
run: |
URL=$(grep -E -o 'https://reports\.cucumber\.io/reports/[a-f0-9\-]+' cucumber_output.txt)
echo "URL extracted: $URL"
cat <<-EOF > report.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0; URL='$URL'" />
<title>Redirecting to Cucumber Reports</title>
</head>
<body>
<p>If you are not redirected, <a href="$URL">click here</a>.</p>
</body>
</html>
EOF
- name: Upload cucumber report
uses: actions/upload-artifact@v4
if: always()
with:
name: report-cucumber
path: report.html
- name: Upload html report
uses: actions/upload-artifact@v4
if: always()
with:
name: report-html
path: target/my-report.html
- name: Rename log file
if: always()
run: |
cp logs/*.log logs/log.log
- name: Upload Execution Log
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-dir
path: ./logs/log.log
- name: Zip video files
if: always()
run: zip -r -9 test-recordings.zip video
- name: Upload Video
if: always()
uses: actions/upload-artifact@v4
with:
name: video-recordings
path: ./test-recordings.zip