diff --git a/.drone.yml b/.drone.yml index 7f6fe3adee9b..8273551e5265 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,7 +69,7 @@ steps: - ./gradlew combinedTestReport - curl -o codecov.sh https://codecov.io/bash - bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5 - + - scripts/uploadArtifact.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN - name: notify image: drillster/drone-email host: $EMAIL_HOST @@ -160,3 +160,33 @@ trigger: event: - push - pull_request +--- +kind: pipeline +name: qa + +steps: + - name: qa + image: nextcloudci/android:android-44 + privileged: true + environment: + LOG_USERNAME: + from_secret: LOG_USERNAME + LOG_PASSWORD: + from_secret: LOG_PASSWORD + GIT_USERNAME: + from_secret: GIT_USERNAME + GIT_TOKEN: + from_secret: GIT_TOKEN + KS_PASS: + from_secret: KS_PASS + KEY_PASS: + from_secret: KEY_PASS + commands: + - sed -i "/qa/,/\}/ s/versionCode .*/versionCode $DRONE_BUILD_NUMBER/" build.gradle + - sed -i "/qa/,/\}/ s/versionName .*/versionName \"$DRONE_BUILD_NUMBER\"/" build.gradle + - ./gradlew assembleQaDebug + - /opt/android-sdk-linux/build-tools/*/apksigner 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 + - scripts/uploadArtifact.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN +trigger: + event: + - pull_request diff --git a/build.gradle b/build.gradle index e47d2037375d..6dd0d7d83a87 100644 --- a/build.gradle +++ b/build.gradle @@ -147,6 +147,13 @@ android { versionCode 20190515 versionName "20190515" } + + qa { + applicationId "com.nextcloud.android.qa" + dimension "default" + versionCode 1 + versionName "1" + } } } @@ -254,6 +261,7 @@ dependencies { genericImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' gplayImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' + qaImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.0.0' diff --git a/drawable_resources/logo_qa.svg b/drawable_resources/logo_qa.svg new file mode 100644 index 000000000000..0376c0b303c0 --- /dev/null +++ b/drawable_resources/logo_qa.svg @@ -0,0 +1,35 @@ + +image/svg+xml + + + + + + diff --git a/scripts/QA_keystore.jks b/scripts/QA_keystore.jks new file mode 100644 index 000000000000..2b8fb9bc2312 Binary files /dev/null and b/scripts/QA_keystore.jks differ diff --git a/scripts/analysis/analysis-wrapper.sh b/scripts/analysis/analysis-wrapper.sh index 601928674f37..427a92d477f7 100755 --- a/scripts/analysis/analysis-wrapper.sh +++ b/scripts/analysis/analysis-wrapper.sh @@ -46,8 +46,8 @@ else echo "New findbugs results at https://www.kaminsky.me/nc-dev/$repository-findbugs/$6.html" curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$6.html --upload-file build/reports/spotbugs/spotbugs.html - # delete all old comments - oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) ' | grep true | tr -d "\"" | cut -f1 -d"|") + # delete all old comments, starting with Codacy + oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test("

Codacy.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|") echo $oldComments | while read comment ; do curl 2>/dev/null -u $1:$2 -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment @@ -55,7 +55,7 @@ else # check library, only if base branch is master baseBranch=$(scripts/analysis/getBranchBase.sh $1 $2 $7 | tr -d "\"") - if [ $baseBranch = "master" -a $(grep "android-library:master" build.gradle -c) -ne 3 ]; then + if [ $baseBranch = "master" -a $(grep "android-library:master" build.gradle -c) -ne 4 ]; then checkLibraryMessage="

Android-library is not set to master branch in build.gradle

" checkLibrary=1 elif [ $baseBranch != "master" -a $baseBranch = $stableBranch -a $(grep "android-library:.*SNAPSHOT" build.gradle -c) -ne 0 ]; then diff --git a/scripts/uploadArtifact.sh b/scripts/uploadArtifact.sh new file mode 100755 index 000000000000..4d62f24ddd67 --- /dev/null +++ b/scripts/uploadArtifact.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +#1: LOG_USERNAME +#2: LOG_PASSWORD +#3: DRONE_BUILD_NUMBER +#4: DRONE_PULL_REQUEST +#5: GIT_USERNAME +#6: GIT_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 +GIT_USERNAME=$5 +GIT_TOKEN=$6 + +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 -u $GIT_USERNAME:$GIT_TOKEN -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test("APK file:.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|") + +echo $oldComments | while read comment ; do + curl 2>/dev/null -u $GIT_USERNAME:$GIT_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 -u $GIT_USERNAME:$GIT_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) \" }" diff --git a/src/qa/google-services.json b/src/qa/google-services.json new file mode 100644 index 000000000000..1f74817b59a9 --- /dev/null +++ b/src/qa/google-services.json @@ -0,0 +1,35 @@ +{ + "project_info": { + "project_number": "", + "project_id": "" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "", + "android_client_info": { + "package_name": "com.nextcloud.android.beta" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 1 + } + } + } + ], + "configuration_version": "1" +} diff --git a/src/qa/ic_launcher-web.png b/src/qa/ic_launcher-web.png new file mode 100644 index 000000000000..8b772004de0d Binary files /dev/null and b/src/qa/ic_launcher-web.png differ diff --git a/src/qa/java/com/nextcloud/client/di/VariantComponentsModule.java b/src/qa/java/com/nextcloud/client/di/VariantComponentsModule.java new file mode 100644 index 000000000000..6afc823f4444 --- /dev/null +++ b/src/qa/java/com/nextcloud/client/di/VariantComponentsModule.java @@ -0,0 +1,26 @@ +/* + * Nextcloud Android client application + * + * @author Chris Narkiewicz + * Copyright (C) 2919 Chris Narkiewicz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this program. If not, see . + */ +package com.nextcloud.client.di; + +import dagger.Module; + +@Module +abstract class VariantComponentsModule { +} diff --git a/src/qa/java/com/owncloud/android/utils/PushUtils.java b/src/qa/java/com/owncloud/android/utils/PushUtils.java new file mode 100644 index 000000000000..706556f70e41 --- /dev/null +++ b/src/qa/java/com/owncloud/android/utils/PushUtils.java @@ -0,0 +1,58 @@ +/** + * Nextcloud Android client application + * + * @author Mario Danic + * @author Chris Narkiewicz Copyright (C) 2017 Mario Danic Copyright (C) 2019 Chris Narkiewicz + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more + * details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. If not, see + * . + */ + +package com.owncloud.android.utils; + +import android.content.Context; + +import com.nextcloud.client.account.UserAccountManager; +import com.nextcloud.client.preferences.AppPreferencesImpl; +import com.owncloud.android.MainApp; +import com.owncloud.android.datamodel.SignatureVerification; + +import java.security.Key; + +public final class PushUtils { + public static final String KEY_PUSH = "push"; + + private PushUtils() { + } + + public static void pushRegistrationToServer( + final UserAccountManager accountManager, + final String pushToken) { + // do nothing + } + + public static void reinitKeys(final UserAccountManager accountManager) { + Context context = MainApp.getAppContext(); + AppPreferencesImpl.fromContext(context).setKeysReInitEnabled(); + } + + public static Key readKeyFromFile(boolean readPublicKey) { + return null; + } + + public static SignatureVerification verifySignature( + final Context context, + final UserAccountManager accountManager, + final byte[] signatureBytes, final byte[] subjectBytes + ) { + return null; + } +} diff --git a/src/qa/java/com/owncloud/android/utils/SecurityUtils.java b/src/qa/java/com/owncloud/android/utils/SecurityUtils.java new file mode 100644 index 000000000000..f3d6ac234b62 --- /dev/null +++ b/src/qa/java/com/owncloud/android/utils/SecurityUtils.java @@ -0,0 +1,20 @@ +/** + * Nextcloud Android client application + * + * @author Mario Danic Copyright (C) 2018 Mario Danic + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more + * details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. If not, see + * . + */ +package com.owncloud.android.utils; + +public class SecurityUtils { +} diff --git a/src/qa/res/drawable-v26/ic_launcher_background.xml b/src/qa/res/drawable-v26/ic_launcher_background.xml new file mode 100644 index 000000000000..d11f5bf128cd --- /dev/null +++ b/src/qa/res/drawable-v26/ic_launcher_background.xml @@ -0,0 +1,1222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/qa/res/drawable-v26/ic_launcher_foreground.xml b/src/qa/res/drawable-v26/ic_launcher_foreground.xml new file mode 100644 index 000000000000..5fdefd797575 --- /dev/null +++ b/src/qa/res/drawable-v26/ic_launcher_foreground.xml @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/src/qa/res/drawable/ic_launcher_background.xml b/src/qa/res/drawable/ic_launcher_background.xml new file mode 100644 index 000000000000..b43644af8750 --- /dev/null +++ b/src/qa/res/drawable/ic_launcher_background.xml @@ -0,0 +1,1203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/qa/res/drawable/ic_launcher_foreground.xml b/src/qa/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 000000000000..19d78d67cc58 --- /dev/null +++ b/src/qa/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,32 @@ + + + + + + + diff --git a/src/qa/res/mipmap-anydpi-v26/ic_launcher.xml b/src/qa/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000000..6b78462d615b --- /dev/null +++ b/src/qa/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/qa/res/mipmap-hdpi/ic_launcher.png b/src/qa/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000000..0f5b931a636f Binary files /dev/null and b/src/qa/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/qa/res/mipmap-mdpi/ic_launcher.png b/src/qa/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000000..d2e43f4fd83c Binary files /dev/null and b/src/qa/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/qa/res/mipmap-xhdpi/ic_launcher.png b/src/qa/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000000..9a4b5c672126 Binary files /dev/null and b/src/qa/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/qa/res/mipmap-xxhdpi/ic_launcher.png b/src/qa/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000000..832df9f52783 Binary files /dev/null and b/src/qa/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/qa/res/mipmap-xxxhdpi/ic_launcher.png b/src/qa/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000000..b964e3fc61c8 Binary files /dev/null and b/src/qa/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/qa/res/values/setup.xml b/src/qa/res/values/setup.xml new file mode 100644 index 000000000000..617e007152e7 --- /dev/null +++ b/src/qa/res/values/setup.xml @@ -0,0 +1,25 @@ + + + + true + false + + + Nextcloud QA + nextcloud.qa + org.nextcloud.qa.provider + org.nextcloud.qa.android.providers.UsersAndGroupsSearchProvider + org.nextcloud.qa.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH + org.nextcloud.qa.documents + org.nextcloud.qa.files + org.nextcloud.qa.android.providers.imageCache + Nextcloud QA + + true + https://github.com/nextcloud/android/commits/master + + + android@nextcloud.com + + +