Skip to content

Commit 6e8d7f1

Browse files
committed
feat: workflow reusable for lauching tests and e2e that calls both reusables
1 parent f7ff824 commit 6e8d7f1

3 files changed

Lines changed: 118 additions & 129 deletions

File tree

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
name: Build apk
22

33
on:
4-
push:
5-
branches:
6-
- develop
74
workflow_dispatch:
85
workflow_call:
96
outputs:
107
artifact-name:
118
description: "Generated APK artifact name"
129
value: ${{ jobs.build_apk.outputs.artifact-name }}
1310

14-
1511
jobs:
1612

1713
# Builds the app with QA variant and publish the apk

.github/workflows/e2e.yml

Lines changed: 14 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,23 @@
11
name: E2E tests
22

33
on:
4+
push:
5+
branches:
6+
- develop
47
workflow_dispatch:
58
schedule:
69
- cron: '30 2 * * 1-5' # Monday to Friday at 2:30AM
7-
pull_request:
8-
branches:
9-
- master
1010

1111
jobs:
12-
13-
# Builds the app with QA variant and publish the apk
1412
build_apk:
15-
name: Build APK
16-
runs-on: ubuntu-latest
17-
outputs:
18-
apk-path: ./src/test/resources/owncloud.apk
19-
20-
steps:
21-
- name: Checkout current repo
22-
uses: actions/checkout@v4
23-
24-
- name: Clone external repo
25-
run: git clone https://github.com/owncloud/android.git android-app
26-
27-
- name: Setup JDK
28-
uses: actions/setup-java@v4
29-
with:
30-
distribution: 'temurin'
31-
java-version: '17'
32-
33-
- name: Cache Gradle
34-
uses: actions/cache@v4
35-
with:
36-
path: |
37-
~/.gradle/caches
38-
~/.gradle/wrapper
39-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
40-
restore-keys: |
41-
${{ runner.os }}-gradle-
42-
43-
- name: Build APK
44-
working-directory: android-app
45-
run: ./gradlew clean assembleqaRelease
46-
47-
- name: Copy APK
48-
id: set-output
49-
run: |
50-
cp ./android-app/owncloudApp/build/outputs/apk/qa/release/owncloud_*-qa-release*.apk ./src/test/resources/owncloud.apk
51-
ls -al ./src/test/resources
52-
53-
- name: Upload APK
54-
uses: actions/upload-artifact@v4
55-
with:
56-
name: app-apk
57-
path: ./src/test/resources/owncloud.apk
58-
59-
run_tests:
60-
name: Run Emulator & Execute Tests & Artifacts
61-
needs: build_apk
62-
runs-on: ubuntu-latest
63-
env:
64-
OC_SERVER_URL: ${{ secrets.OC_SERVER_URL }}
65-
BACKEND: oCIS
66-
67-
steps:
68-
- name: Checkout current repo
69-
uses: actions/checkout@v4
70-
71-
# Uploaded in the job above
72-
- name: Download APK
73-
uses: actions/download-artifact@v4
74-
with:
75-
name: app-apk
76-
path: ./src/test/resources
77-
78-
# Improves emulator's performance by using hardware acceleration
79-
- name: Enable KVM
80-
run: |
81-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
82-
sudo udevadm control --reload-rules
83-
sudo udevadm trigger --name-match=kvm
84-
85-
- name: Start Appium
86-
run: |
87-
mkdir -p logs video
88-
chmod +x ./runAppium.sh
89-
./runAppium.sh
90-
91-
- name: Run Emulator & Tests
92-
uses: reactivecircus/android-emulator-runner@v2
93-
id: execution
94-
with:
95-
api-level: 31
96-
target: google_apis
97-
arch: x86_64
98-
profile: pixel_5
99-
avd-name: test-avd
100-
force-avd-creation: true
101-
disable-animations: true
102-
emulator-options: -no-snapshot -no-window -no-audio -no-boot-anim -accel on -memory 3072
103-
# Ignored tests, no oCIS tests and no CI tests will not run
104-
script: ./executeTests -t "not @ignore and not @noocis and not @noci"
105-
106-
- name: Upload html report
107-
uses: actions/upload-artifact@v4
108-
if: always()
109-
with:
110-
name: report-html
111-
path: target/my-report.html
112-
113-
- name: Rename log file
114-
if: always()
115-
run: |
116-
cp logs/*.log logs/log.log
117-
118-
- name: Upload Execution Log
119-
if: always()
120-
uses: actions/upload-artifact@v4
121-
with:
122-
name: logs-dir
123-
path: ./logs/log.log
124-
125-
- name: Zip video files
126-
if: always()
127-
run: zip -r -9 test-recordings.zip video
128-
129-
- name: Upload Video
130-
if: always()
131-
uses: actions/upload-artifact@v4
132-
with:
133-
name: video-recordings
134-
path: ./test-recordings.zip
13+
uses: ./.github/workflows/buildapk.yml
14+
15+
tests:
16+
needs:
17+
- build_apk
18+
uses: ./.github/workflows/e2etests.yml
19+
with:
20+
apk: ${{ needs.build_apk.outputs.artifact-name }}
21+
backend: oCIS
22+
secrets:
23+
oc_server_url: ${{ secrets.OC_SERVER_URL }}

.github/workflows/e2etests.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Execute tests
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
inputs:
7+
apk:
8+
description: '.apk to execute'
9+
type: string
10+
backend:
11+
description: 'type of backend'
12+
type: string
13+
secrets:
14+
oc_server_url:
15+
description: 'server url'
16+
type: string
17+
outputs:
18+
report:
19+
description: "Test report"
20+
value: report
21+
logs:
22+
description: "Execution logs"
23+
value: logs
24+
video:
25+
description: "Video recording"
26+
value: video
27+
28+
jobs:
29+
30+
run_tests:
31+
name: Run Emulator & Execute Tests & Artifacts
32+
runs-on: ubuntu-latest
33+
env:
34+
OC_SERVER_URL: ${{ secrets.oc_server_url }}
35+
BACKEND: ${{ inputs.backend }}
36+
37+
steps:
38+
- name: Checkout current repo
39+
uses: actions/checkout@v4
40+
41+
# Uploaded in the above
42+
- name: Download APK
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: ${{ inputs.apk }}
46+
path: ./src/test/resources
47+
48+
# Improves emulator's performance by using hardware acceleration
49+
- name: Enable KVM
50+
run: |
51+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
52+
sudo udevadm control --reload-rules
53+
sudo udevadm trigger --name-match=kvm
54+
55+
- name: Start Appium
56+
run: |
57+
mkdir -p logs video
58+
chmod +x ./runAppium.sh
59+
./runAppium.sh
60+
61+
- name: Run Emulator & Tests
62+
uses: reactivecircus/android-emulator-runner@v2
63+
id: execution
64+
with:
65+
api-level: 31
66+
target: google_apis
67+
arch: x86_64
68+
profile: pixel_5
69+
avd-name: test-avd
70+
force-avd-creation: true
71+
disable-animations: true
72+
emulator-options: -no-snapshot -no-window -no-audio -no-boot-anim -accel on -memory 3072
73+
# Ignored tests, no oCIS tests and no CI tests will not run
74+
script: ./executeTests -t "@createfolder and not @ignore and not @noocis"
75+
76+
- name: Upload html report
77+
uses: actions/upload-artifact@v4
78+
if: always()
79+
with:
80+
name: report
81+
path: target/my-report.html
82+
83+
- name: Rename log file
84+
if: always()
85+
run: |
86+
cp logs/*.log logs/log.log
87+
88+
- name: Upload Execution Log
89+
if: always()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: logs
93+
path: ./logs/log.log
94+
95+
- name: Zip video files
96+
if: always()
97+
run: zip -r -9 test-recordings.zip video
98+
99+
- name: Upload Video
100+
if: always()
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: video
104+
path: ./test-recordings.zip

0 commit comments

Comments
 (0)