diff --git a/.github/workflow/qa.yml b/.github/workflow/qa.yml new file mode 100644 index 000000000..fe98a553e --- /dev/null +++ b/.github/workflow/qa.yml @@ -0,0 +1,29 @@ +name: "QA" + +on: + pull_request: + branches: [ master, stable-* ] + +jobs: + qa: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build QA + env: + KS_PASS: ${{ secrets.KS_PASS }} + KEY_PASS: ${{ secrets.KEY_PASS }} + LOG_USERNAME: ${{ secrets.LOG_USERNAME }} + LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }} + run: | + mkdir -p $HOME/.gradle + echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties + sed -i "/qa/,/\}/ s/versionCode .*/versionCode ${{github.event.number}} /" build.gradle + sed -i "/qa/,/\}/ s/versionName .*/versionName \"${{github.event.number}}\"/" build.gradle + ./gradlew assembleQaDebug + $(find /usr/local/lib/android/sdk/build-tools/*/apksigner | sort | tail -n1) sign --ks-pass pass:$KS_PASS --key-pass pass:$KEY_PASS --ks-key-alias key0 --ks scripts/QA_keystore.jks build/outputs/apk/qa/debug/qa-debug-*.apk + sudo scripts/uploadArtifact.sh $LOG_USERNAME $LOG_PASSWORD ${{github.event.number}} ${{github.event.number}} ${{ secrets.GITHUB_TOKEN }} diff --git a/app/build.gradle b/app/build.gradle index 357dbe3c5..3d3f4e739 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,7 +33,6 @@ android { compileSdkVersion 29 buildToolsVersion '28.0.3' defaultConfig { - applicationId "com.nextcloud.talk2" minSdkVersion 21 targetSdkVersion 29 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -49,9 +48,20 @@ android { productFlavors { // used for f-droid - generic - gplay - + generic { + applicationId 'com.nextcloud.talk2' + dimension "default" + } + gplay { + applicationId 'com.nextcloud.talk2' + dimension "default" + } + qa { + applicationId "com.nextcloud.talk2.qa" + dimension "default" + versionCode 1 + versionName "1" + } } // Enabling multidex support. @@ -86,6 +96,7 @@ android { } packagingOptions { + exclude 'META-INF/LICENSE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude 'META-INF/rxjava.properties' diff --git a/app/src/qa/ic_launcher-web.png b/app/src/qa/ic_launcher-web.png new file mode 100644 index 000000000..9bde487a3 Binary files /dev/null and b/app/src/qa/ic_launcher-web.png differ diff --git a/app/src/qa/java/com/nextcloud/talk/utils/ClosedInterfaceImpl.java b/app/src/qa/java/com/nextcloud/talk/utils/ClosedInterfaceImpl.java new file mode 100644 index 000000000..66496bd31 --- /dev/null +++ b/app/src/qa/java/com/nextcloud/talk/utils/ClosedInterfaceImpl.java @@ -0,0 +1,36 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017-2018 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.utils; + + +import com.nextcloud.talk.interfaces.ClosedInterface; + +public class ClosedInterfaceImpl implements ClosedInterface { + @Override + public void providerInstallerInstallIfNeededAsync() { + // does absolutely nothing :) + } + + @Override + public boolean isGooglePlayServicesAvailable() { + return false; + } +} diff --git a/app/src/qa/res/drawable-v24/ic_launcher_background.xml b/app/src/qa/res/drawable-v24/ic_launcher_background.xml new file mode 100644 index 000000000..3f3d4b826 --- /dev/null +++ b/app/src/qa/res/drawable-v24/ic_launcher_background.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/app/src/qa/res/drawable/ic_launcher_background.xml b/app/src/qa/res/drawable/ic_launcher_background.xml new file mode 100644 index 000000000..a931ebc5f --- /dev/null +++ b/app/src/qa/res/drawable/ic_launcher_background.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + diff --git a/app/src/qa/res/drawable/ic_launcher_foreground.xml b/app/src/qa/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 000000000..2b7fc86b2 --- /dev/null +++ b/app/src/qa/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/qa/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/qa/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000..bbd3e0212 --- /dev/null +++ b/app/src/qa/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/qa/res/mipmap-hdpi/ic_launcher.png b/app/src/qa/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..99024db8e Binary files /dev/null and b/app/src/qa/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/qa/res/mipmap-mdpi/ic_launcher.png b/app/src/qa/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..2b6d24b1c Binary files /dev/null and b/app/src/qa/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/qa/res/mipmap-xhdpi/ic_launcher.png b/app/src/qa/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..a0528c11b Binary files /dev/null and b/app/src/qa/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/qa/res/mipmap-xxhdpi/ic_launcher.png b/app/src/qa/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..a2a2f2731 Binary files /dev/null and b/app/src/qa/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/qa/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/qa/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..677ffdd25 Binary files /dev/null and b/app/src/qa/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/qa/res/values/setup.xml b/app/src/qa/res/values/setup.xml new file mode 100644 index 000000000..0650249ab --- /dev/null +++ b/app/src/qa/res/values/setup.xml @@ -0,0 +1,25 @@ + + + + + Nextcloud Talk QA + Nextcloud + diff --git a/drawable_resources/icon-background.svg b/drawable_resources/icon-background.svg index b2618fccd..fc99ed29e 100644 --- a/drawable_resources/icon-background.svg +++ b/drawable_resources/icon-background.svg @@ -1,309 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/drawable_resources/icon-foreground_qa.svg b/drawable_resources/icon-foreground_qa.svg new file mode 100644 index 000000000..42f765cfa --- /dev/null +++ b/drawable_resources/icon-foreground_qa.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/scripts/uploadArtifact.sh b/scripts/uploadArtifact.sh new file mode 100644 index 000000000..e14f48ad1 --- /dev/null +++ b/scripts/uploadArtifact.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +#1: LOG_USERNAME +#2: LOG_PASSWORD +#3: DRONE_BUILD_NUMBER +#4: DRONE_PULL_REQUEST +#5: GITHUB_TOKEN + +DAV_URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-artifacts/ +PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-artifacts +USER=$1 +PASS=$2 +BUILD=$3 +PR=$4 +GITHUB_TOKEN=$5 + +if ! test -e build/outputs/apk/qa/debug/qa-debug-*.apk ; then + exit 1 +fi +echo "Uploaded artifact to $DAV_URL/$BUILD.apk" + +# delete all old comments, starting with "APK file:" +oldComments=$(curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("github-actions") | tostring) + "|" + (.body | test("APK file:.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|") + +echo $oldComments | while read comment ; do + curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment +done + +apt-get -y install qrencode + +qrencode -o $PR.png "$PUBLIC_URL/$BUILD.apk" + +curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.apk --upload-file build/outputs/apk/qa/debug/qa-debug-*.apk +curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.png --upload-file $PR.png +curl --header "authorization: Bearer $GITHUB_TOKEN" -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments -d "{ \"body\" : \"APK file: $PUBLIC_URL/$BUILD.apk

![qrcode]($PUBLIC_URL/$BUILD.png)

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app. \" }"