Add pipeline tests

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2021-12-07 14:06:17 +01:00
parent 390fa154b5
commit d7b3ba17de
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E
2 changed files with 134 additions and 61 deletions

View File

@ -1,11 +1,12 @@
kind: pipeline kind: pipeline
type: docker
name: generic name: generic
steps: steps:
- name: generic - name: generic
image: nextcloudci/android:android-44 image: nextcloudci/android:android-44
commands: commands:
- ./gradlew --console=plain assembleGeneric - ./gradlew --console=plain assembleGeneric
trigger: trigger:
branch: branch:
@ -16,66 +17,114 @@ trigger:
--- ---
kind: pipeline kind: pipeline
type: docker
name: gplay name: gplay
steps: steps:
- name: gplay - name: gplay
image: nextcloudci/android:android-44 image: nextcloudci/android:android-44
commands: commands:
- ./gradlew --console=plain assembleGplay - ./gradlew --console=plain assembleGplay
trigger: trigger:
branch: branch:
- master - master
event: event:
- push - push
- pull_request - pull_request
---
kind: pipeline ---
name: analysis kind: pipeline
type: docker
steps: name: tests
- name: analysis
image: nextcloudci/android:android-44 steps:
environment: - name: tests
GIT_USERNAME: image: nextcloudci/android:android-49
from_secret: GIT_USERNAME privileged: true
GIT_TOKEN: commands:
from_secret: GIT_TOKEN - emulator-headless -avd android-27 -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
LOG_USERNAME: - scripts/wait_for_emulator.sh
from_secret: LOG_USERNAME - ./gradlew --console=plain connectedGplayDebugAndroidTest
LOG_PASSWORD:
from_secret: LOG_PASSWORD
commands: #services:
- export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST) # - name: server
- scripts/analysis/analysis-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST # image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
# environment:
- name: notify # EVAL: true
image: drillster/drone-email # commands:
host: $EMAIL_HOST # - BRANCH='stable22' /usr/local/bin/initnc.sh
port: 587 # - echo 127.0.0.1 server >> /etc/hosts
username: $EMAIL_USERNAME # - su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
password: $EMAIL_PASSWORD # - su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
from: nextcloud-drone@kaminsky.me # - su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
skip_verify: true # - su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
recipients_only: true # - su www-data -c "php /var/www/html/occ group:add users"
recipients: [ $EMAIL_RECIPIENTS ] # - su www-data -c "php /var/www/html/occ group:adduser users user1"
environment: # - su www-data -c "php /var/www/html/occ group:adduser users user2"
EMAIL_USERNAME: # - su www-data -c "git clone -b stable22 https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
from_secret: EMAIL_USERNAME # - su www-data -c "php /var/www/html/occ app:enable activity"
EMAIL_PASSWORD: # - su www-data -c "git clone -b stable22 https://github.com/nextcloud/text.git /var/www/html/apps/text/"
from_secret: EMAIL_PASSWORD # - su www-data -c "php /var/www/html/occ app:enable text"
EMAIL_RECIPIENTS: # - su www-data -c "git clone -b stable22 https://github.com/nextcloud/end_to_end_encryption.git /var/www/html/apps/end_to_end_encryption/"
from_secret: EMAIL_RECIPIENTS # - su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
EMAIL_HOST: # - /usr/local/bin/run.sh
from_secret: EMAIL_HOST
when: trigger:
event: branch:
- push - master
status: event:
- failure - push
branch: - pull_request
- master
---
kind: pipeline
type: docker
name: analysis
steps:
- name: analysis
image: nextcloudci/android:android-44
environment:
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
commands:
- export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
- scripts/analysis/analysis-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST
- name: notify
image: drillster/drone-email
host: $EMAIL_HOST
port: 587
username: $EMAIL_USERNAME
password: $EMAIL_PASSWORD
from: nextcloud-drone@kaminsky.me
skip_verify: true
recipients_only: true
recipients: [ $EMAIL_RECIPIENTS ]
environment:
EMAIL_USERNAME:
from_secret: EMAIL_USERNAME
EMAIL_PASSWORD:
from_secret: EMAIL_PASSWORD
EMAIL_RECIPIENTS:
from_secret: EMAIL_RECIPIENTS
EMAIL_HOST:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
trigger: trigger:
branch: branch:

24
scripts/wait_for_emulator.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# Originally written by Ralf Kistner <ralf@embarkmobile.com>, but placed in the public domain
bootanim=""
failcounter=0
checkcounter=0
until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1`
echo "($checkcounter) $bootanim"
if [[ "$bootanim" =~ "not found" || "$bootanim" =~ "error" ]]; then
let "failcounter += 1"
if [[ $failcounter -gt 3 ]]; then
echo "Failed to start emulator"
exit 1
fi
fi
let "checkcounter += 1"
sleep 20
done
echo "($checkcounter) Done"
adb -e shell input keyevent 82
echo "($checkcounter) Unlocked emulator screen"