Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 127 additions & 12 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ services:
- su www-data -c "git clone --depth 1 https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
- su www-data -c "cd /var/www/html/apps/photos; composer install --no-dev"
- su www-data -c "php /var/www/html/occ app:enable -f photos"
- su www-data -c "git clone --depth 1 https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
- su www-data -c "git clone --depth 1 -b main https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
- su www-data -c "cd /var/www/html/apps/assistant; source ~/.bashrc; composer install --no-dev"
- su www-data -c "php /var/www/html/occ app:enable -f assistant"
- su www-data -c "php /var/www/html/occ app:enable -f testing"
Expand All @@ -128,7 +128,7 @@ trigger:
---
kind: pipeline
type: docker
name: test-stable
name: test-stable-latest

steps:
- name: test
Expand All @@ -145,16 +145,16 @@ steps:
from_secret: GIT_TOKEN
commands:
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
- sed -i s"#server#server-stable#" gradle.properties
- sed -i s"#server#server-stable-latest#" gradle.properties
- sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt
- ./gradlew assembleDebug
- ./scripts/wait_for_emulator.sh
- ./scripts/wait_for_server.sh server-stable
- scripts/deleteOutdatedComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- scripts/deleteOutdatedComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./scripts/wait_for_server.sh server-stable-latest
- scripts/deleteOutdatedComments.sh "stable-latest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- scripts/deleteOutdatedComments.sh "stable-latest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-latest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installDebugAndroidTest
- ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-latest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew combinedTestReport
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
Expand Down Expand Up @@ -184,10 +184,10 @@ steps:
- stable-*

services:
- name: server-stable
- name: server-stable-latest
image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest
environment:
SERVER_VERSION: stable32
SERVER_VERSION: stable33
commands:
- rm /etc/apt/sources.list.d/php.list
- apt-get update && apt-get install -y composer
Expand Down Expand Up @@ -229,7 +229,7 @@ services:
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
- su www-data -c "cd /var/www/html/apps/photos; composer install --no-dev"
- su www-data -c "php /var/www/html/occ app:enable -f photos"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
- su www-data -c "git clone --depth 1 -b main https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
- su www-data -c "cd /var/www/html/apps/assistant; source ~/.bashrc; composer install --no-dev"
- su www-data -c "php /var/www/html/occ app:enable assistant"
- su www-data -c "php /var/www/html/occ app:enable -f testing"
Expand All @@ -248,7 +248,122 @@ trigger:
- push
- pull_request
---
kind: pipeline
type: docker
name: test-stable-oldest

steps:
- name: test
image: ghcr.io/nextcloud/continuous-integration-android8:4
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
commands:
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
- sed -i s"#server#server-stable-oldest#" gradle.properties
- sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt
- ./gradlew assembleDebug
- ./scripts/wait_for_emulator.sh
- ./scripts/wait_for_server.sh server-stable-oldest
- scripts/deleteOutdatedComments.sh "stable-oldest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- scripts/deleteOutdatedComments.sh "stable-oldest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-oldest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installDebugAndroidTest
- ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-oldest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew combinedTestReport
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
- ./codecov -t 2eec98c3-ff20-4cad-9e08-463471a33431

- name: notify
image: drillster/drone-email
settings:
port: 587
from: nextcloud-drone@kaminsky.me
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
- stable-*

services:
- name: server-stable-oldest
image: ghcr.io/nextcloud/continuous-integration-shallow-server-php7.4:1
environment:
SERVER_VERSION: stable20
commands:
- rm /etc/apt/sources.list.d/php.list
- apt-get update && apt-get install -y composer
- mkdir /var/www/.nvm /var/www/.npm; touch /var/www/.bashrc; chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc
- su www-data -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash"
- su www-data -c "source ~/.bashrc; nvm install node"
- BRANCH="$SERVER_VERSION" /usr/local/bin/initnc.sh
- su www-data -c "php /var/www/html/occ log:manage --level warning"
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
- su www-data -c "OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test@Test' test@test"
- su www-data -c "OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test Spaces' 'test test'"
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
- su www-data -c "php /var/www/html/occ group:add users"
- su www-data -c "php /var/www/html/occ group:adduser users user1"
- su www-data -c "php /var/www/html/occ group:adduser users user2"
- su www-data -c "php /var/www/html/occ group:adduser users test"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
- su www-data -c "php /var/www/html/occ app:enable activity"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/text.git /var/www/html/apps/text/"
- su www-data -c "php /var/www/html/occ app:enable text"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/end_to_end_encryption.git /var/www/html/apps/end_to_end_encryption/"
- su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/password_policy.git /var/www/html/apps/password_policy/"
- su www-data -c "php /var/www/html/occ app:enable password_policy"
- su www-data -c "php /var/www/html/occ app:enable external"
- su www-data -c 'php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}"'
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/"
- su www-data -c "php /var/www/html/occ app:enable -f groupfolders"
- su www-data -c "php /var/www/html/occ groupfolders:create groupfolder"
- su www-data -c "php /var/www/html/occ groupfolders:group 1 users"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/"
- su www-data -c "cd /var/www/html/apps/notifications"
- su www-data -c "php /var/www/html/occ app:enable -f notifications"
- su www-data -c "php /var/www/html/occ notification:generate test test"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
- su www-data -c "cd /var/www/html/apps/photos"
- su www-data -c "php /var/www/html/occ app:enable -f photos"
- su www-data -c "php /var/www/html/occ app:enable -f testing"
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/recommendations.git /var/www/html/apps/recommendations/"
- su www-data -c "php /var/www/html/occ app:enable recommendations"
- su www-data -c "php /var/www/html/occ config:system:set ratelimit.protection.enabled --value false --type bool"
- /usr/local/bin/run.sh

trigger:
branch:
- master
- stable-*
event:
- push
- pull_request
---
kind: signature
hmac: d51bba0f9e5754b040cc2a99847a261a21e283074dabffa811f0c0eaf11f6968
hmac: b26e47fc03b18d8521973aa42f47b82f98b0c61c1836a99e454e9792dbee02ae

...
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class DashboardGetWidgetItemsRemoteOperationIT : AbstractIT() {

@Test
fun getEmptyItems() {
// only on NC25+
testOnlyOnServer(NextcloudVersion.nextcloud_25)

val widgetId = "nonExistingWidget"
val result =
DashboardGetWidgetItemsRemoteOperation(widgetId, LIMIT_SIZE).execute(nextcloudClient)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation
import com.owncloud.android.lib.resources.files.model.RemoteFile
import com.owncloud.android.lib.resources.status.NextcloudVersion
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
Expand Down Expand Up @@ -62,7 +63,10 @@ class UnifiedSearchRemoteOperationIT : AbstractIT() {

assertNotNull(firstResult)
assertEquals(remotePath, firstResult?.remotePath())
assertEquals(fileId.toString(), firstResult?.fileId())

if (isServerAtLeast(NextcloudVersion.nextcloud_21)) {
assertEquals(fileId.toString(), firstResult?.fileId())
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation;
import com.owncloud.android.lib.resources.status.GetStatusRemoteOperation;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;

import org.apache.commons.httpclient.HttpStatus;
Expand Down Expand Up @@ -353,4 +352,14 @@ protected void testOnlyOnServer(OwnCloudVersion version) {
assumeFalse(true);
}
}

protected boolean isServerAtLeast(OwnCloudVersion version) {
final var result = new GetCapabilitiesRemoteOperation().execute(nextcloudClient);

if (result.isSuccess()) {
return result.getResultData().getVersion().isNewerOrEqual(version);
} else {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ private void checkCapability(OCCapability capability, String userId) {

@Test
public void testClientIntegration() {
// only on NC32+
testOnlyOnServer(NextcloudVersion.nextcloud_32);

// get capabilities
RemoteOperationResult<OCCapability> result = new GetCapabilitiesRemoteOperation().execute(nextcloudClient);
assertTrue(result.isSuccess());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ class ReadFileRemoteOperationIT : AbstractIT() {
val remoteFile = result.data[0] as RemoteFile

@Suppress("Detekt.MagicNumber")
assertEquals(ImageDimension(451f, 529f), remoteFile.imageDimension)
if (isServerAtLeast(NextcloudVersion.nextcloud_21)) {
assertEquals(ImageDimension(451f, 529f), remoteFile.imageDimension)
}

testOnlyOnServer(NextcloudVersion.nextcloud_27)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation;
import com.owncloud.android.lib.resources.status.NextcloudVersion;
import com.owncloud.android.lib.resources.status.OCCapability;

import org.junit.BeforeClass;
Expand Down Expand Up @@ -200,7 +201,16 @@ public void favoriteFiles() throws IOException {
assertEquals(2, result.getResultData().size());

assertEquals(remotePath, result.getResultData().get(0).getRemotePath());
assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath());

String expectedSharedRemotePath;
if (isServerAtLeast(NextcloudVersion.nextcloud_21)) {
expectedSharedRemotePath = sharedRemotePath;
} else {
// Bug: shared search ends with "/" even for files
expectedSharedRemotePath = sharedRemotePath + "/";
}
assertEquals(expectedSharedRemotePath, result.getResultData().get(1).getRemotePath());

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ package com.owncloud.android.lib.resources.users

import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.e2ee.DeleteEncryptedFilesRemoteOperation
import com.owncloud.android.lib.resources.status.NextcloudVersion
import junit.framework.TestCase.assertTrue
import org.junit.Before
import org.junit.Test

class DeleteE2ERemoteOperationIT : AbstractIT() {
@Before
fun before() {
testOnlyOnServer(NextcloudVersion.nextcloud_34)
}

@Test
fun testDeleteEncryptedFiles() {
val sut = DeleteEncryptedFilesRemoteOperation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package com.owncloud.android.lib.resources.users

import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.status.NextcloudVersion
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
Expand Down Expand Up @@ -40,7 +41,13 @@ class StatusIT : AbstractIT() {
val result0 = SetStatusRemoteOperation(StatusType.ONLINE).execute(nextcloudClient)
assertTrue("SetStatusRemoteOperation failed: " + result0.logMessage, result0.isSuccess)

for (statusType in StatusType.values()) {
val status = StatusType.entries.toMutableList()

if (!isServerAtLeast(NextcloudVersion.nextcloud_21)) {
status.remove(StatusType.BUSY)
}

for (statusType in status) {
val result1 = GetStatusRemoteOperation().run(nextcloudClient)
assertTrue("GetStatusRemoteOperation failed: " + result1.logMessage, result1.isSuccess)

Expand Down
Loading