1313permissions :
1414 # Only need read access to repository contents
1515 contents : read
16+ actions : read
1617
1718jobs :
18- build_apks :
19+ build_and_test :
1920 # Job to build APKs for the latest commit and the commit that triggered the workflow
20- name : Build APKs
21+ name : Build and Test
2122 runs-on : ubuntu-latest
22- strategy :
23- matrix :
24- # Run matrix for latest commit on branch and current commit SHA
25- commit : ["latest", "${{ github.sha }}"]
26-
23+
2724 env :
2825 BUILD_TOOLS_VERSION : " 34.0.0"
26+ GITHUB_SHA : ${{ github.sha }}
2927
3028 steps :
31- # Checkout the specific commit from matrix
29+ # Checkout the specific commit
3230 - name : Checkout specific commit
3331 uses : actions/checkout@v5
3432 with :
35- ref : ${{ matrix.commit }}
33+ ref : ${{ github.sha }}
3634
3735 # Set up Java JDK required for Gradle
3836 - name : Set up JDK
4341
4442 # Set up Android SDK and build tools
4543 - name : Set up Android SDK
46- uses : android-actions/setup-android@v2
44+ uses : android-actions/setup-android@v3
4745
4846 # Cache Gradle dependencies to speed up builds
4947 - name : Cache Gradle
6260
6361 # Copy the built APK to a commit-specific name
6462 - name : Get apk
65- run : cp owncloudApp/build/outputs/apk/qa/release/owncloud_*-qa-release*.apk owncloud-${{ matrix.commit }}.apk
63+ run : cp owncloudApp/build/outputs/apk/qa/release/owncloud_*-qa-release*.apk owncloud-${{ github.sha }}.apk
6664
6765 # Decode keystore from secret for signing
6866 - name : Restore keystore
7270 # Align and sign the APK
7371 - name : Sign APK
7472 run : |
75- APK_INPUT="owncloud-${{ matrix.commit }}.apk"
76- APK_ALIGNED="owncloud-${{ matrix.commit }}-aligned.apk"
77- APK_SIGNED="owncloudSigned-${{ matrix.commit }}.apk"
73+ APK_INPUT="owncloud-${{ github.sha }}.apk"
74+ APK_ALIGNED="owncloud-${{ github.sha }}-aligned.apk"
75+ APK_SIGNED="owncloudSigned-${{ github.sha }}.apk"
7876 KEYSTORE="./test.keystore"
7977 KEY_ALIAS="${{ secrets.TEST_KS_ALIAS }}"
8078 KEY_PASSWORD="${{ secrets.TEST_KS_KEY }}"
@@ -103,40 +101,33 @@ jobs:
103101 - name : Upload APK as artifact
104102 uses : actions/upload-artifact@v4
105103 with :
106- name : owncloudSigned-${{ matrix.commit }}
107- path : ./owncloudSigned-${{ matrix.commit }}.apk
108- # Removed after 1 day
104+ name : owncloudSigned-${{ github.sha }}
105+ path : ./owncloudSigned-${{ github.sha }}.apk
109106 retention-days : 1
110107
111- execute_tests :
112- # Job to run tests using the APKs built in previous job
113- name : Execute tests
114- needs : build_apks
115- runs-on : ubuntu-latest
116-
117- env :
118- GITHUB_SHA : ${{ github.sha }}
119-
120- steps :
121-
122108 # Clean up the workspace
123109 - name : Clean up
124- run : rm -rf ${{ github.workspace }}/*
110+ run : |
111+ rm -rf ${{ github.workspace }}/*
112+ rm -rf ${{ github.workspace }}/.[!.]*
113+ rm -rf ${{ github.workspace }}/..?*
125114
126115 # Clone repository containing update tests
127116 - name : Clone tests repo
128117 run : git clone https://github.com/owncloud/android-update-testing.git .
129118
130- # Download APK built from latest commit
131- - name : Get apk built from latest
132- uses : actions/ download-artifact@v4
119+ # Download APK built last latest signing
120+ - name : Download latest signed APK
121+ uses : dawidd6/action- download-artifact@v11
133122 with :
123+ workflow : build-apk-from-latest.yml
134124 name : owncloudSigned-latest
125+ workflow_conclusion : success
135126 path : ./src/test/resources
136127
137128 # Download APK built from current commit
138129 - name : Get apk built from current
139- uses : actions/download-artifact@v4
130+ uses : actions/download-artifact@v5
140131 with :
141132 name : owncloudSigned-${{ github.sha }}
142133 path : ./src/test/resources
@@ -154,7 +145,7 @@ jobs:
154145 run : |
155146 mkdir -p logs video
156147 chmod +x ./runAppium.sh
157- ./runAppium.sh &
148+ ./runAppium.sh
158149
159150 # Enable KVM for emulator acceleration
160151 - name : Enable KVM
@@ -208,12 +199,20 @@ jobs:
208199 name : logs
209200 path : ./logs/log.log
210201
202+ # Upload appium log
203+ - name : Upload Appium Log
204+ if : always()
205+ uses : actions/upload-artifact@v4
206+ with :
207+ name : appium
208+ path : ./appium.log
209+
211210 # Prepare video file to be uploaded by compressing it
212211 - name : Zip video files
213212 if : always()
214213 run : zip -r -9 test-recording.zip video || true
215214
216- # Upload video file
215+ # Upload video file
217216 - name : Upload Video
218217 if : always()
219218 uses : actions/upload-artifact@v4
0 commit comments