repo created

This commit is contained in:
Fr4nz D13trich 2025-09-18 17:54:51 +02:00
commit 1ef725ef20
2483 changed files with 278273 additions and 0 deletions

BIN
scripts/QA_keystore.jks Normal file

Binary file not shown.

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -0,0 +1,152 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
BRANCH=$1
LOG_USERNAME=$2
LOG_PASSWORD=$3
BUILD_NUMBER=$4
PR_NUMBER=$5
stableBranch="stable-3.29"
repository="android"
ruby scripts/analysis/lint-up.rb
lintValue=$?
curl "https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.xml" -o "/tmp/$stableBranch.xml"
ruby scripts/analysis/spotbugs-up.rb "$stableBranch"
spotbugsValue=$?
# exit codes:
# 0: count was reduced
# 1: count was increased
# 2: count stayed the same
source scripts/lib.sh
echo "Branch: $BRANCH"
if [ "$BRANCH" = $stableBranch ]; then
echo "New spotbugs result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html"
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file app/build/reports/spotbugs/spotbugs.html
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.xml" --upload-file app/build/reports/spotbugs/gplayDebug.xml
if [ $lintValue -ne 1 ]; then
echo "New lint result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-lint/$stableBranch.html"
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$stableBranch.html --upload-file app/build/reports/lint/lint.html
exit 0
fi
else
if [ -e "${BUILD_NUMBER}" ]; then
6=$stableBranch"-"$(date +%F)
fi
echo "New lint results at https://www.kaminsky.me/nc-dev/$repository-lint/${BUILD_NUMBER}.html"
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/${BUILD_NUMBER}.html" --upload-file app/build/reports/lint/lint.html
echo "New spotbugs results at https://www.kaminsky.me/nc-dev/$repository-findbugs/${BUILD_NUMBER}.html"
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/${BUILD_NUMBER}.html" --upload-file app/build/reports/spotbugs/spotbugs.html
# delete all old comments, starting with Codacy
oldComments=$(curl_gh -X GET "https://api.github.com/repos/nextcloud/$repository/issues/${PR_NUMBER}/comments" | jq '.[] | select((.user.login | contains("github-actions")) and (.body | test("<h1>Codacy.*"))) | .id')
echo "$oldComments" | while read -r comment ; do
curl_gh -X DELETE "https://api.github.com/repos/nextcloud/$repository/issues/comments/$comment"
done
# lint and spotbugs file must exist
if [ ! -s app/build/reports/lint/lint.html ] ; then
echo "lint.html file is missing!"
exit 1
fi
if [ ! -s app/build/reports/spotbugs/spotbugs.html ] ; then
echo "spotbugs.html file is missing!"
exit 1
fi
# add comment with results
lintResultNew=$(grep "Lint Report.* [0-9]* warning" app/build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<')
lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ")
if ( [ -z $lintErrorNew ] ); then
lintErrorNew=0
fi
lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ")
if ( [ -z $lintWarningNew ] ); then
lintWarningNew=0
fi
lintResultOld=$(curl 2>/dev/null "https://raw.githubusercontent.com/nextcloud/$repository/$stableBranch/scripts/analysis/lint-results.txt")
lintErrorOld=$(echo $lintResultOld | grep "[0-9]* error" -o | cut -f1 -d" ")
if ( [ -z $lintErrorOld ] ); then
lintErrorOld=0
fi
lintWarningOld=$(echo $lintResultOld | grep "[0-9]* warning" -o | cut -f1 -d" ")
if ( [ -z $lintWarningOld ] ); then
lintWarningOld=0
fi
if [ $stableBranch = "master" ] ; then
codacyValue=$(curl 2>/dev/null https://app.codacy.com/dashboards/breakdown\?projectId\=44248 | grep "total issues" | cut -d">" -f3 | cut -d"<" -f1)
codacyResult="<h1>Codacy</h1>$codacyValue"
else
codacyResult=""
fi
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/$repository-lint/$stableBranch.html'>$stableBranch</a></td><td><a href='https://www.kaminsky.me/nc-dev/$repository-lint/${BUILD_NUMBER}.html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>$lintWarningOld</td><td>$lintWarningNew</td></tr><tr class='tablerow0'><td>Errors</td><td>$lintErrorOld</td><td>$lintErrorNew</td></tr></table>"
spotbugsResult="<h1>SpotBugs</h1>$(scripts/analysis/spotbugsComparison.py "/tmp/$stableBranch.xml" app/build/reports/spotbugs/gplayDebug.xml --link-new "https://www.kaminsky.me/nc-dev/$repository-findbugs/${BUILD_NUMBER}.html" --link-base "https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html")"
if ( [ $lintValue -eq 1 ] ) ; then
lintMessage="<h1>Lint increased!</h1>"
fi
if ( [ $spotbugsValue -eq 1 ] ) ; then
spotbugsMessage="<h1>SpotBugs increased!</h1>"
fi
# check gplay limitation: all changelog files must only have 500 chars
gplayLimitation=$(scripts/checkGplayLimitation.sh)
if [ ! -z "$gplayLimitation" ]; then
gplayLimitation="<h1>Following files are beyond 500 char limit:</h1><br><br>"$gplayLimitation
fi
# check for NotNull
if [[ $(grep org.jetbrains.annotations app/src/main/* -irl | wc -l) -gt 0 ]] ; then
notNull="org.jetbrains.annotations.* is used. Please use androidx.annotation.* instead.<br><br>"
fi
bodyContent="$codacyResult $lintResult $spotbugsResult $lintMessage $spotbugsMessage $gplayLimitation $notNull"
echo "$bodyContent" >> "$GITHUB_STEP_SUMMARY"
payload="{ \"body\" : \"$bodyContent\" }"
curl_gh -X POST "https://api.github.com/repos/nextcloud/$repository/issues/${PR_NUMBER}/comments" -d "$payload"
if [ ! -z "$gplayLimitation" ]; then
exit 1
fi
if [ $checkLibrary -eq 1 ]; then
exit 1
fi
if [ ! $lintValue -eq 2 ]; then
exit $lintValue
fi
if [ -n "$notNull" ]; then
exit 1
fi
if [ $spotbugsValue -eq 2 ]; then
exit 0
else
exit $spotbugsValue
fi
fi

View file

@ -0,0 +1,15 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
snapshotCount=$(./gradlew dependencies | grep SNAPSHOT | grep -v "com.github.nextcloud:android-library" -c)
betaCount=$(grep "<bool name=\"is_beta\">true</bool>" app/src/main/res/values/setup.xml -c)
if [[ $snapshotCount -eq 0 && $betaCount -eq 0 ]] ; then
exit 0
else
exit 1
fi

View file

@ -0,0 +1,15 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
PR_NUMBER=$1
source scripts/lib.sh
if [ -z "${PR_NUMBER}" ] ; then
echo "master";
else
curl_gh "https://api.github.com/repos/nextcloud/android/pulls/${PR_NUMBER}" | jq .base.ref
fi

View file

@ -0,0 +1,13 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
# $1: username, $2: password/token, $3: pull request number
if [ -z $3 ] ; then
echo "stable-3.29";
else
curl 2>/dev/null -u $1:$2 https://api.github.com/repos/nextcloud/android/pulls/$3 | grep \"ref\": | grep -v '"stable-3.29"' | cut -d"\"" -f4
fi

View file

@ -0,0 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 3 errors and 69 warnings</span>

View file

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later

191
scripts/analysis/lint-up.rb Normal file
View file

@ -0,0 +1,191 @@
## Script from https://github.com/tir38/android-lint-entropy-reducer at 07.05.2017
# adapts to drone, use git username / token as parameter
# TODO cleanup this script, it has a lot of unused stuff
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017 Jason Atwood
# SPDX-FileCopyrightText: 2017 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
puts "=================== starting Android Lint Entropy Reducer ===================="
# ======================== SETUP ============================
# User name for git commits made by this script.
TRAVIS_GIT_USERNAME = String.new("Drone CI server")
# File name and relative path of generated Lint report. Must match build.gradle file:
# lintOptions {
# htmlOutput file("[FILE_NAME].html")
# }
LINT_REPORT_FILE = String.new("app/build/reports/lint/lint.html")
# File name and relative path of previous results of this script.
PREVIOUS_LINT_RESULTS_FILE=String.new("scripts/analysis/lint-results.txt")
# Flag to evaluate warnings. true = check warnings; false = ignore warnings
CHECK_WARNINGS = true
# File name and relative path to custom lint rules; Can be null or "".
CUSTOM_LINT_FILE = String.new("")
# ================ SETUP DONE; DON'T TOUCH ANYTHING BELOW ================
require 'fileutils'
require 'pathname'
require 'open3'
# since we need the xml-simple gem, and we want this script self-contained, let's grab it just when we need it
begin
gem "xml-simple"
rescue LoadError
system("gem install --user-install xml-simple")
Gem.clear_paths
end
require 'xmlsimple'
# add custom Lint jar
if !CUSTOM_LINT_FILE.nil? &&
CUSTOM_LINT_FILE.length > 0
ENV["ANDROID_LINT_JARS"] = Dir.pwd + "/" + CUSTOM_LINT_FILE
puts "adding custom lint rules to default set: "
puts ENV["ANDROID_LINT_JARS"]
end
# run Lint
puts "running Lint..."
system './gradlew clean lintGplayDebug 1>/dev/null'
# confirm that Lint ran w/out error
result = $?.to_i
if result != 0
puts "FAIL: failed to run ./gradlew clean lintGplayDebug"
exit 1
end
# find Lint report file
lint_reports = Dir.glob(LINT_REPORT_FILE)
if lint_reports.length == 0
puts "Lint HTML report not found."
exit 1
end
lint_report = String.new(lint_reports[0])
# find error/warning count string in HTML report
error_warning_string = ""
File.open lint_report do |file|
error_warning_string = file.find { |line| line =~ /([0-9]* error[s]? and )?[0-9]* warning[s]?/ }
end
# find number of errors
error_string = error_warning_string.match(/[0-9]* error[s]?/)
if (error_string.nil?)
current_error_count = 0
else
current_error_count = error_string[0].match(/[0-9]*/)[0].to_i
end
puts "found errors: " + current_error_count.to_s
# find number of warnings
if CHECK_WARNINGS == true
warning_string = error_warning_string.match(/[0-9]* warning[s]?/)[0]
current_warning_count = warning_string.match(/[0-9]*/)[0].to_i
puts "found warnings: " + current_warning_count.to_s
end
# get previous error and warning counts from last successful build
previous_results = false
previous_lint_reports = Dir.glob(PREVIOUS_LINT_RESULTS_FILE)
if previous_lint_reports.nil? ||
previous_lint_reports.length == 0
previous_lint_report = File.new(PREVIOUS_LINT_RESULTS_FILE, "w") # create for writing to later
else
previous_lint_report = String.new(previous_lint_reports[0])
previous_error_warning_string = ""
File.open previous_lint_report do |file|
previous_error_warning_string = file.find { |line| line =~ /([0-9]* error[s]? and )?[0-9]* warning[s]?/ }
end
unless previous_error_warning_string.nil?
previous_results = true
previous_error_string = previous_error_warning_string.match(/[0-9]* error[s]?/)
if previous_error_string.nil?
previous_error_string = "0 errors"
else
previous_error_string = previous_error_string[0]
end
previous_error_count = previous_error_string.match(/[0-9]*/)[0].to_i
puts "previous errors: " + previous_error_count.to_s
if CHECK_WARNINGS == true
previous_warning_string = previous_error_warning_string.match(/[0-9]* warning[s]?/)
if previous_warning_string.nil?
previous_warning_string = "0 warnings"
else
previous_warning_string = previous_warning_string[0]
end
previous_warning_count = previous_warning_string.match(/[0-9]*/)[0].to_i
puts "previous warnings: " + previous_warning_count.to_s
end
end
end
# compare previous error count with current error count
if previous_results == true &&
current_error_count > previous_error_count
puts "FAIL: error count increased"
exit 1
end
# compare previous warning count with current warning count
if CHECK_WARNINGS == true &&
previous_results == true &&
current_warning_count > previous_warning_count
puts "FAIL: warning count increased"
exit 1
end
# check if warning and error count stayed the same
if previous_results == true &&
current_error_count == previous_error_count &&
current_warning_count == previous_warning_count
puts "SUCCESS: count stayed the same"
exit 2
end
# either error count or warning count DECREASED
# write new results to file (will overwrite existing, or create new)
File.write(previous_lint_report, "DO NOT TOUCH; GENERATED BY DRONE\n" + error_warning_string)
# update git user name and email for this script
system ("git config --local user.name 'github-actions'")
system ("git config --local user.email 'github-actions@github.com'")
# add previous Lint result file to git
system ('git add ' + PREVIOUS_LINT_RESULTS_FILE)
# commit changes
system('git commit -sm "Analysis: update lint results to reflect reduced error/warning count"')
# push to origin
system ('git push')
puts "SUCCESS: count was reduced"
exit 0 # success

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
~ SPDX-FileCopyrightText: 2024 Andy Scherzinger <info@andy-scherzinger.de>
~ SPDX-License-Identifier: AGPL-3.0-or-later
-->
<FindBugsFilter>
<Match>
<Class name="~.*\.Manifest\$.*" />
</Match>
<Match>
<Class name="~.*\.R\$.*" />
</Match>
<Match>
<Class name="~.*\.R\$.*" />
</Match>
<Match>
<Class name="~.*\$\$Parcelable.*" />
</Match>
<!-- Dagger code is autogenerated. Exclude it from Check. -->
<Match>
<Or>
<Class name="~.*\.Dagger.*" />
<Class name="~com\.nextcloud\.client\.di\..*_.*" />
<Class name="~dagger\.android\..*" />
</Or>
</Match>
<!-- Dagger generated code uses internal APIs -->
<Match>
<Or>
<Class name="~.*\..*.*Factory" />
<Class name="~.*\..*.*Factory_Impl" />
</Or>
<Bug pattern="IICU_INCORRECT_INTERNAL_CLASS_USE" />
</Match>
<!-- Data bindings autogenerated classes -->
<Match>
<Or>
<Class name="~.*BindingImpl"/>
<Class name="~.*\.DataBinderMapperImpl" />
<Class name="~.*Binding" />
</Or>
</Match>
<!-- Third-party library code -->
<Match>
<Or>
<Package name="~io\.noties\..*" />
<Package name="~third_parties\.ezvcard_android\..*" />
<Package name="~com\.afollestad\.sectionedrecyclerview\..*" />
<Package name="~butterknife\..*" />
<Package name="~de\.cotech\..*" />
<Package name="~pl\.droidsonroids\..*" />
<Package name="~third_parties\..*" />
</Or>
</Match>
<Match>
<Class name="~com\.owncloud\.android\.ui\.preview\.MarkwonGrammarLocator.*" />
</Match>
<Bug pattern="PATH_TRAVERSAL_IN" />
<Bug pattern="ANDROID_EXTERNAL_FILE_ACCESS" />
<Bug pattern="BAS_BLOATED_ASSIGNMENT_SCOPE" />
<Bug pattern="IMC_IMMATURE_CLASS_BAD_SERIALVERSIONUID" />
<Bug pattern="EI_EXPOSE_REP" />
<Bug pattern="EI_EXPOSE_REP2" />
<!-- This is unmanageable for now due to large amount of interconnected static state -->
<Bug pattern="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY" />
<!--Autogenerated Room classes-->
<Match>
<Class name="~.*\.NextcloudDatabase_Impl.*" />
</Match>
<Match>
<Class name="~.*\..*Dao_Impl.*" />
</Match>
</FindBugsFilter>

View file

@ -0,0 +1,53 @@
## Script originally from https://github.com/tir38/android-lint-entropy-reducer at 07.05.2017
# heavily modified since then
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017 Jason Atwood
# SPDX-FileCopyrightText: 2017 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
puts "=================== starting Android Spotbugs Entropy Reducer ===================="
# get args
base_branch = ARGV[0]
require 'fileutils'
require 'pathname'
require 'open3'
# run Spotbugs
puts "running Spotbugs..."
system './gradlew spotbugsGplayDebug'
# find number of warnings
current_warning_count = `./scripts/analysis/spotbugsSummary.py --total`.to_i
puts "found warnings: " + current_warning_count.to_s
# get warning counts from target branch
previous_xml = "/tmp/#{base_branch}.xml"
previous_results = File.file?(previous_xml)
if previous_results == true
previous_warning_count = `./scripts/analysis/spotbugsSummary.py --total --file #{previous_xml}`.to_i
puts "previous warnings: " + previous_warning_count.to_s
end
# compare previous warning count with current warning count
if previous_results == true && current_warning_count > previous_warning_count
puts "FAIL: warning count increased"
exit 1
end
# check if warning and error count stayed the same
if previous_results == true && current_warning_count == previous_warning_count
puts "SUCCESS: count stayed the same"
exit 0
end
# warning count DECREASED
if previous_results == true && current_warning_count < previous_warning_count
puts "SUCCESS: count decreased from " + previous_warning_count.to_s + " to " + current_warning_count.to_s
end

View file

@ -0,0 +1,56 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
import argparse
import defusedxml.ElementTree as ET
import spotbugsSummary
def print_comparison(old: dict, new: dict, link_base: str, link_new: str):
all_keys = sorted(set(list(old.keys()) + list(new.keys())))
output = "<table><tr><th>Category</th>"
old_header = f"<a href='{link_base}'>Base</a>" if link_base is not None else "Base"
output += f"<th>{old_header}</th>"
new_header = f"<a href='{link_new}'>New</a>" if link_new is not None else "New"
output += f"<th>{new_header}</th>"
output += "</tr>"
for category in all_keys:
category_count_old = old[category] if category in old else 0
category_count_new = new[category] if category in new else 0
new_str = f"<b>{category_count_new}</b>" if category_count_new != category_count_old else str(category_count_new)
output += "<tr>"
output += f"<td>{category}</td>"
output += f"<td>{category_count_old}</td>"
output += f"<td>{new_str}</td>"
output += "</tr>"
output += "<tr>"
output += "<td><b>Total</b></td>"
output += f"<td><b>{sum(old.values())}</b></td>"
output += f"<td><b>{sum(new.values())}</b></td>"
output += "</tr>"
output += "</table>"
print(output)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("base_file", help="base file for comparison")
parser.add_argument("new_file", help="new file for comparison")
parser.add_argument("--link-base", help="http link to base html report")
parser.add_argument("--link-new", help="http link to new html report")
args = parser.parse_args()
base_tree = ET.parse(args.base_file)
base_summary = spotbugsSummary.get_counts(base_tree)
new_tree = ET.parse(args.new_file)
new_summary = spotbugsSummary.get_counts(new_tree)
print_comparison(base_summary, new_summary, args.link_base, args.link_new)

View file

@ -0,0 +1,64 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
import argparse
import defusedxml.ElementTree as ET
def get_counts(tree):
category_counts = {}
category_names = {}
for child in tree.getroot():
if child.tag == "BugInstance":
category = child.attrib['category']
if category in category_counts:
category_counts[category] = category_counts[category] + 1
else:
category_counts[category] = 1
elif child.tag == "BugCategory":
category = child.attrib['category']
category_names[category] = child[0].text
summary = {}
for category in category_counts.keys():
summary[category_names[category]] = category_counts[category]
return summary
def print_html(summary):
output = "<table><tr><th>Category</th><th>Count</th></tr>"
categories = sorted(summary.keys())
for category in categories:
output += "<tr>"
output += f"<td>{category}</td>"
output += f"<td>{summary[category]}</td>"
output += "</tr>"
output += "<tr>"
output += "<td><b>Total</b></td>"
output += f"<td><b>{sum(summary.values())}</b></td>"
output += "</tr>"
output += "</table>"
print(output)
def print_total(summary):
print(sum(summary.values()))
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--total", help="print total count instead of summary HTML",
action="store_true")
parser.add_argument("--file", help="file to parse", default="app/build/reports/spotbugs/gplayDebug.xml")
args = parser.parse_args()
tree = ET.parse(args.file)
summary = get_counts(tree)
if args.total:
print_total(summary)
else:
print_html(summary)

92
scripts/androidScreenshotTest Executable file
View file

@ -0,0 +1,92 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2020-2024 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
set -e
if [ $# -lt 2 ]; then
echo "1: record: true/false
2: class name
3: method name
4: darkMode: dark/light / \"all\" to run all screenshot combinations
5: color"
exit
fi
pushd app/src/androidTest/java
class=$(find | grep $2 | grep -E "java$|kt$" | head -n1|sed s'/\//\./'g | sed s'#^\.\.##' | sed s'#\.java##'| sed s'#\.kt##')
if [[ -z $class ]]; then
echo "Class not found!"
exit 1
fi
cd ../../../
if [ $1 == "true" ] ; then
record="-Precord"
else
record=""
fi
if [ -e $3 ] ; then
method=""
else
method="#$3"
# check if method exists
if [[ $(grep -c $3 $(find | grep $2 | grep -E "java$|kt$" | head -n1)) -eq 0 ]]; then
echo "Method not found!"
exit 1
fi
fi
if [ -e $4 ] ; then
darkMode=""
else
darkMode="-Pandroid.testInstrumentationRunnerArguments.DARKMODE=$4"
fi
popd
sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g app/src/main/res/values/setup.xml
# check if emulator is running
emulatorIsRunning=false
while read line ; do
if [[ $(adb -s $line emu avd name 2>/dev/null | head -n1) =~ uiComparison.* ]]; then
emulatorIsRunning=true
export ANDROID_SERIAL=$line
break
fi
done < <(adb devices | cut -f1)
if [ "$emulatorIsRunning" == false ] ; then
"$(command -v emulator)" -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 &
sleep 20
fi
if [ -e $5 ] ; then
color=""
else
color="-Pandroid.testInstrumentationRunnerArguments.COLOR=$5"
fi
if [[ $4 = "all" ]]; then
scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method"
else
SHOT_TEST=true ./gradlew --offline gplayDebugExecuteScreenshotTests $record \
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED" \
-Pscreenshot=true \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.class=$class$method \
$darkMode \
$color
fi
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g app/src/main/res/values/setup.xml
unset ANDROID_SERIAL

90
scripts/buildDev Executable file
View file

@ -0,0 +1,90 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
date=$(date +%Y%m%d)
oldLibraryCommit=$(grep "androidLibraryVersion\ =" build.gradle)
libraryCommit=$(curl https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
# use current date for version code/name
sed -i "/versionDev/,/\}/ s/versionCode .*/versionCode $date/" app/build.gradle
sed -i "/versionDev/,/\}/ s/versionName .*/versionName \"$date\"/" app/build.gradle
# change library
sed -i s"#androidLibraryVersion\ =.*#androidLibraryVersion =\"$libraryCommit\"#" build.gradle
./gradlew --console=plain --dependency-verification lenient -q --write-verification-metadata sha256,pgp help
# build signed apk
source ndk.env
yes | sdkmanager --licenses
if [ ! -e ~/android-sdk/ndk/${NDK_VERSION} ]; then
sdkmanager "ndk;${NDK_VERSION}"
fi
if [ ! -e ~/android-sdk/cmake/${CMAKE_VERSION} ]; then
sdkmanager "cmake;${CMAKE_VERSION}"
fi
./gradlew assembleVersionDevRelease >> /tmp/dev.log 2>&1
if [ $? != 0 ] ; then
echo "Build error!"
exit 1
fi
# sign
mkdir -p ~/apks
source ~/.gradle/devVersionSecrets
apksigner sign --ks-pass env:VERSION_DEV_STORE_PASSWORD \
--key-pass env:VERSION_DEV_KEY_PASSWORD \
--ks $VERSION_DEV_STORE_FILE \
--out ~/apks/nextcloud-dev-$date.apk \
./app/build/outputs/apk/versionDev/release/versionDev-release-$date.apk
# use the current date
echo $date > ~/apks/latest
ln -s nextcloud-dev-$date.apk latest.apk
mv latest.apk ~/apks/
# remove all but the latest 5 apks
/bin/ls -t ~/apks/*.apk | awk 'NR>6' | xargs rm -f
lastBuildTag=$(git tag | grep dev | tail -n1)
# Show only the commit subject in the changelog and filter out:
# * Merges
# * Dependabot commits
# * Commits touching only non-user-facing stuff like tests
# * Version bump commits
# * Anything reachable from the previous dev edition tag
changelog=$(git log --no-merges --invert-grep --author=dependabot --pretty='format:%s' HEAD "^$lastBuildTag" -- ':!app/src/androidTest' ':!.*' ':!scripts/' ':!screenshots' ':!CHANGELOG.md' | grep -vE '^daily dev [[:digit:]]{8}$')
# Make Transifex updates have a nicer description
if echo "$changelog" | grep -q 'tx-robot'; then
changelog=$(echo "$changelog" | grep -v 'tx-robot')
# This is a funky bashism - preceding a single-quote string with $ lets you put escape chars in it
changelog="${changelog}"$'\nUpdate translations'
fi
# Check if the library was updated
if ! echo $oldLibraryCommit | grep -q $libraryCommit; then
changelog="${changelog}"$'\nUpdate Nextcloud Android library'
fi
# Collapse dependency updates into a single "Update dependencies" entry
if git log --pretty='format:%an' HEAD "^$lastBuildTag" | grep -q dependabot; then
changelog="${changelog}"$'\nUpdate 3rd-party dependencies'
fi
# changelog
echo "$changelog" > src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
git add .
git commit -m "daily dev $date" -m "$changelog"
git push
git tag dev-$date
git push origin dev-$date

18
scripts/checkGplayLimitation.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
result=""
for log in fastlane/metadata/android/*/changelogs/*
do
if [[ -e $log && $(wc -m $log | cut -d" " -f1) -gt 500 ]]
then
result=$log"<br>"$result
fi
done
echo -e "$result";

21
scripts/checkIfRunDrone.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh -e
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019-2022 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
PR_NUMBER=$1
if [ -z "$PR_NUMBER" ] ; then
echo "Merge commit to master -> continue with CI"
exit 0
fi
export BRANCH=$(scripts/analysis/getBranchBase.sh "$PR_NUMBER" | sed 's/"//g')
if [ "$(git diff --name-only "origin/$BRANCH" | grep -cE "^app/src|screenshots|build.gradle|.drone.yml|gradle")" -eq 0 ] ; then
echo "No source files changed"
exit 1
else
echo "Source files changed -> continue with CI"
exit 0
fi

31
scripts/deleteOldComments.sh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#1: BRANCH
#2: TYPE
#3: PR
# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
BRANCH=$1
TYPE=$2
PR=$3
source scripts/lib.sh
BRANCH_TYPE=$BRANCH-$TYPE
# delete all old comments, matching this type
echo "Deleting old comments for $BRANCH_TYPE"
oldComments=$(curl_gh -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("(nextcloud-android-bot|github-actions)") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
count=$(echo -n "$oldComments" | grep -c '^')
echo "Found $count old comments"
if [ "$count" -gt 0 ]; then
echo "$oldComments" | while read comment ; do
echo "Deleting comment: $comment"
curl_gh -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
done
fi
exit 0

View file

@ -0,0 +1,69 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
error=0
total=0
cp scripts/screenshotCombinations scripts/screenshotCombinations_
grep -v "#" scripts/screenshotCombinations_ > scripts/screenshotCombinations
rm scripts/screenshotCombinations_
echo '<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8"/>
</head>'
echo "<table>"
echo "<tr><td style='width:150px'>Original</td>"
while read line; do
echo "<td style='width:150px'>$line</td>"
done < scripts/screenshotCombinations
echo "</tr>"
#for image in ./build/reports/shot/verification/images/*.png ; do
for image in $(/bin/ls -1 ./screenshots/gplay/debug/*.png | grep -v _dark_ | grep -v _light_) ; do
cp $image app/build/screenshotSummary/images/
echo "<tr style='height:200px'>"
echo "<td><a target='_blank' href=\"images/$(basename $image)\"><img width=100px src=\"images/$(basename $image)\"/></a></td>"
while read line; do
echo "<td>"
mode=$(echo $line | cut -d" " -f1)
color=$(echo $line | cut -d" " -f2)
total=$((total + 1))
if [ $mode = "light" -a $color = "blue" ]; then
name=$(basename $image)
else
name=$(basename $image| sed s"/\.png/_${mode}_$color\.png/")
fi
# if image does not exist
if [ ! -e ./app/build/reports/shot/verification/images/$name ]; then
echo "<span style='color: red'>✘</span>"
error=$((error + 1))
elif [ -e ./app/build/reports/shot/verification/images/diff_$name ]; then
# file with "diff_" prefix
cp ./app/build/reports/shot/verification/images/diff_$name build/screenshotSummary/images/
echo "<a target='_blank' href=\"images/diff_$name\"><img width=100px src=\"images/diff_$name\"/></a>"
error=$((error + 1))
else
echo "✔"
fi
echo "</td>"
done < scripts/screenshotCombinations
echo "</tr>"
done
echo "</table>"
echo "ERROR: $error / $total"
echo "</html>"

19
scripts/hooks/pre-commit Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
# Pre-commit hook: don't allow commits if detekt or ktlint fail. Skip with "git commit --no-verify".
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021 Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
echo "Running pre-commit checks..."
if ! ./gradlew --daemon spotlessKotlinCheck &>/dev/null; then
echo >&2 "ktlint failed! Run ./gradlew spotlessKotlinCheck for details"
echo >&2 "Hint: fix most lint errors with ./gradlew spotlessKotlinApply"
exit 1
fi
if ! ./gradlew --daemon detekt &>/dev/null; then
echo >&2 "Detekt failed! See report at file://$(pwd)/app/build/reports/detekt/detekt.html"
exit 1
fi

32
scripts/hooks/pre-push Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
# Pre-push: Don't allow commits without Signed-off-by. Skip with "git push --no-verify".
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021 Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
set -euo pipefail
z40=0000000000000000000000000000000000000000 # magic deleted ref
while read local_ref local_sha remote_ref remote_sha; do
if [ "$local_sha" != $z40 ]; then
if [ "$remote_sha" = $z40 ]; then
# New branch, examine all commits
range="$(git merge-base master $local_sha)..$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi
# Check for commits without sign-off
commit=$(git rev-list --no-merges --grep 'Signed-off-by' --invert-grep "$range")
if [ -n "$commit" ]; then
echo >&2 "Found commits without sign-off in $local_ref. Aborting push. Offending commits:"
echo >&2 "$commit"
exit 1
fi
fi
done
exit 0

27
scripts/lib.sh Normal file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2022 Álvaro Brey <alvaro@alvarobrey.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
## This file is intended to be sourced by other scripts
function err() {
echo >&2 "$@"
}
function curl_gh() {
if [[ -n "$GITHUB_TOKEN" ]]
then
curl \
--silent \
--header "Authorization: token $GITHUB_TOKEN" \
"$@"
else
err "WARNING: No GITHUB_TOKEN found. Skipping API call"
fi
}

View file

@ -0,0 +1,135 @@
#!/usr/bin/env python3
# Author: Torsten Grote
# License: GPLv3 or later
# copied on 2017/11/06 from https://github.com/grote/Transportr/blob/master/fastlane/generate_metadata.py
# adapted by Tobias Kaminsky
# SPDX-FileCopyrightText: 2017 Torsten Grote
# SPDX-FileCopyrightText: 2017-2018 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
import codecs
import os
import shutil
from xml.etree import ElementTree
XML_PATH = '../../app/src/main/res'
METADATA_PATH = '../../src/generic/fastlane/metadata/android/'
METADATA_DEV_PATH = '../../src/versionDev/fastlane/metadata/android/'
DEFAULT_LANG = 'en-US'
LANG_MAP = {
'values': 'en-US',
'values-en-rGB': 'en-GB',
'values-ca': 'ca',
'values-cs': 'cs-CZ',
'values-de': 'de-DE',
'values-es': 'es-ES',
'values-fr': 'fr-FR',
'values-hu': 'hu-HU',
'values-it': 'it-IT',
'values-pt-rBR': 'pt-BR',
'values-pt-rPT': 'pt-PT',
'values-ta': 'ta-IN',
'values-sv': 'sv-SE',
'values-sq-rAL': 'sq-AL',
'values-sq-rMK': 'sq-MK',
'values-iw-rIL': 'iw-IL',
'values-ar': 'ar-AR',
'values-bg-rBG': 'bg-BG',
'values-da': 'da-DK',
'values-fi-rFI': 'fi-FI',
'values-gl-rES': 'gl-ES',
'values-tr': 'tr-TR',
'values-uk': 'uk-UK',
'values-vi': 'vi-VI',
'values-ro': 'ro-RO',
'values-ou': 'ru-RU',
'values-sr': 'sr-SR',
'values-pl': 'pl-PL',
'values-el': 'el-GR',
'values-ko': 'ko-KR',
'values-nl': 'nl-NL',
'values-ja': 'ja-JP',
'values-no-rNO': 'no-NO',
'values-eu': 'eu-ES',
'values-lt-rLT': 'lt-LT',
'values-zh-rKN': 'zh-HK',
'values-zk': 'zk-CN',
'values-is': 'is-IS',
'values-id': 'id-ID',
'values-cs-rCZ': 'cs-CZ',
'values-sl': 'sl-SL',
'values-fa': 'fa-FA'
}
PATH = os.path.dirname(os.path.realpath(__file__))
def main():
path = os.path.join(PATH, XML_PATH)
for entry in os.listdir(path):
directory = os.path.join(path, entry)
if not os.path.isdir(directory) or entry not in LANG_MAP.keys():
continue
strings_file = os.path.join(directory, 'strings.xml')
if not os.path.isfile(strings_file):
print("Error: %s does not exist" % strings_file)
continue
print()
print(LANG_MAP[entry])
print("Parsing %s..." % strings_file)
e = ElementTree.parse(strings_file).getroot()
short_desc = e.find('.//string[@name="store_short_desc"]')
full_desc = e.find('.//string[@name="store_full_desc"]')
short_dev_desc = e.find('.//string[@name="store_short_dev_desc"]')
full_dev_desc = e.find('.//string[@name="store_full_dev_desc"]')
if short_desc is not None:
save_file(short_desc.text, LANG_MAP[entry], 'short_description.txt', False)
if short_dev_desc is not None:
save_file(short_dev_desc.text, LANG_MAP[entry], 'short_description.txt', True)
if full_desc is not None:
save_file(full_desc.text, LANG_MAP[entry], 'full_description.txt', False)
if full_dev_desc is not None:
save_file(full_dev_desc.text, LANG_MAP[entry], 'full_description.txt', True)
def save_file(text, directory, filename, dev):
if dev:
directory_path = os.path.join(PATH, METADATA_DEV_PATH, directory)
else:
directory_path = os.path.join(PATH, METADATA_PATH, directory)
if not os.path.exists(directory_path):
os.makedirs(directory_path)
if filename == 'short_description.txt':
limit = 80
else:
limit = 0
text = clean_text(text, limit)
check_title(directory_path)
file_path = os.path.join(directory_path, filename)
print("Writing %s..." % file_path)
with codecs.open(file_path, 'w', 'utf-8') as f:
f.write(text)
def clean_text(text, limit=0):
text = text.replace('\\\'', '\'').replace('\\n', '\n')
if limit != 0 and len(text) > limit:
print("Warning: Short Description longer than 80 characters, truncating...")
text = text[:limit]
return text
def check_title(directory):
title_path = os.path.join(directory, 'title.txt')
if os.path.exists(title_path):
return
default_title_path = os.path.join(directory, '..', DEFAULT_LANG, 'title.txt')
shutil.copy(default_title_path, title_path)
if __name__ == "__main__":
main()

View file

@ -0,0 +1,57 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2020 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
## $1 noCI/stable/master: wether to run deleteOldComments.sh or uploadReport.sh
## $2 true/false: record or verify screenshots
## $3 classMethod: piped from androidScreenshotTest
## $4 github event number
sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g app/src/main/res/values/setup.xml
if [[ $2 = "true" ]]; then
record="-Precord"
else
record=""
fi
classMethod=$3
resultCode=0
grep -v "#" scripts/screenshotCombinations | while read line
do
darkMode=$(echo "$line" | cut -d" " -f1)
color=$(echo "$line" | cut -d" " -f2)
echo -n "Run $color on $darkMode mode"
if [[ $1 = "noCI" ]]; then
./gradlew --console plain gplayDebugExecuteScreenshotTests \
$record \
-Pscreenshot=true \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
$classMethod </dev/null > /dev/null
if [[ $? -ne 0 ]]; then
echo " failed!"
else
echo
fi
else
./gradlew --console plain gplayDebugExecuteScreenshotTests \
$record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" </dev/null > /dev/null \
&& scripts/deleteOldComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
"$1-$darkMode-$color" "Screenshot" "$4"
fi
done
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g app/src/main/res/values/setup.xml
exit $resultCode

53
scripts/runCombinedTest.sh Executable file
View file

@ -0,0 +1,53 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021-2023 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
DRONE_PULL_REQUEST=$1
LOG_USERNAME=$2
LOG_PASSWORD=$3
DRONE_BUILD_NUMBER=$4
function upload_logcat() {
log_filename="${DRONE_PULL_REQUEST}_logcat.txt.xz"
log_file="app/build/${log_filename}"
upload_path="https://nextcloud.kaminsky.me/remote.php/webdav/android-logcat/$log_filename"
xz logcat.txt
mv logcat.txt.xz "$log_file"
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "$upload_path" --upload-file "$log_file"
echo >&2 "Uploaded logcat to https://www.kaminsky.me/nc-dev/android-logcat/$log_filename"
}
scripts/deleteOldComments.sh "master" "IT" "$DRONE_PULL_REQUEST"
./gradlew assembleGplayDebugAndroidTest
scripts/wait_for_emulator.sh
./gradlew installGplayDebugAndroidTest
scripts/wait_for_server.sh "server"
# clear logcat and start saving it to file
adb logcat -c
adb logcat > logcat.txt &
LOGCAT_PID=$!
./gradlew createGplayDebugCoverageReport \
-Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest \
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"
stat=$?
# stop saving logcat
kill $LOGCAT_PID
if [ ! $stat -eq 0 ]; then
upload_logcat
bash scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" "master" "IT" "$DRONE_PULL_REQUEST"
fi
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t fc506ba4-33c3-43e4-a760-aada38c24fd5 -F integration
echo "Exit with: " $stat
exit $stat

View file

@ -0,0 +1,10 @@
light blue
#dark blue
#light white
#dark white
#light black
#dark black
#light red
#dark red
#light lightgreen
dark lightgreen

View file

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: 2020-2021 Tobias Kaminsky <tobias@kaminsky.me>
SPDX-License-Identifier: AGPL-3.0-or-later

14
scripts/screenshotSummary.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
mkdir -p app/build/screenshotSummary/images
scripts/generateScreenshotOverview.sh > app/build/screenshotSummary/summary.html
error=$?
scripts/uploadScreenshotSummary.sh $LOG_USERNAME $LOG_PASSWORD
exit $error

View file

@ -0,0 +1,98 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017-2018-2024 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
cd scripts/screenshots/
for i in $(find ../../fastlane | grep png | grep Screenshots) ; do
device=$(echo $i | cut -d"/" -f8 | sed s'#Screenshots##')
textID=$(echo $i | cut -d"/" -f9 | cut -d"_" -f1,2)
locale=$(echo $i | cut -d"/" -f6)
# handle some locales different
case $locale in
"en-US")
locale=""
;;
"en-GB")
locale="-b+en+001"
;;
"de-DE")
locale="-de"
;;
"es-MX")
locale="-es-rMX"
;;
"hu-HU")
locale="-hu-rHU"
;;
"ka-GE")
locale="-ka-rGE"
;;
"no-NO")
locale="-nb-rNO"
;;
"pt-BR")
locale="-pt-rBR"
;;
"pt-PT")
locale="-pt-rPT"
;;
"bg-BG")
locale="-bg-rBG"
;;
"fi-FI")
locale="-fi-rFI"
;;
"uk-UK")
locale=""
;;
"ja-JP")
locale="-ja-rJP"
;;
"lt-LT")
locale="-lt-rLT"
;;
"zh-HK")
locale="-zh-rCN"
;;
"zk-CN")
locale="-zh-rCN"
;;
"id-ID")
locale="-in"
;;
"cs-CZ")
locale="-cs-rCZ"
;;
*)
locale="-"$(echo $locale | cut -d"-" -f1)
esac
if [ -e ../../app/src/main/res/values$locale/strings.xml ] ; then
heading=$(grep $textID"_heading" ../../app/src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
subline=$(grep $textID"_subline" ../../app/src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
else
heading=""
subline=""
fi
# fallback to english if there is not translation
if [ -z "$heading" ]; then
heading=$(grep $textID"_heading" ../../app/src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
fi
if [ -z "$subline" ]; then
subline=$(grep $textID"_subline" ../../app/src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
fi
sed "s#{image}#$i#;s#{heading}#$heading#;s#{subline}#$subline#g" $device.svg > temp.svg
if [ $textID == "06_davdroid" ] ; then
sed "s#display:none#display:visible#" -i temp.svg
fi
inkscape temp.svg -h 576 -e $i 2>/dev/null
done

View file

@ -0,0 +1,36 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2020-2018-2024 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
file=/tmp/screenshotOverview-$(date +%F-%H-%M-%S)
echo "<html><table>" >> $file
echo "<tr>
<td>Test name</td>
<td>Blue on light</td>
<td>Blue on dark</td>
<td>White on light</td>
<td>White on dark</td>
</tr>" >> $file
for screenshot in $(find screenshots/gplay -type f | grep -v "_dark_" | grep -v "_light_" | sort); do
echo "<tr>" >> $file
#name
echo "<td>$screenshot (base)</td>" >> $file
#base
echo "<td><img width='200px' src="$(pwd)/$screenshot"></td>" >> $file
baseName=$(echo $screenshot | sed s'/\.png//')
for type in dark_blue light_white dark_white; do
echo "<td><img width='200px' src=\"$(pwd)/$baseName""_""$type.png\"></td>" >> $file
done
echo "</tr>" >> $file
done
echo "</table></html>" >> $file
echo $file

View file

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="483.30557mm" height="800mm"
viewBox="0 0 483.30556 800.00003" version="1.1" id="svg4553" inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="phone.svg">
<defs
id="defs4547">
<linearGradient
inkscape:collect="always"
id="linearGradient832">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop828" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop830" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient832"
id="radialGradient836"
cx="2564.2764"
cy="7303.2788"
fx="2564.2764"
fy="7303.2788"
r="115.44445"
gradientTransform="matrix(1,0,0,0.37896268,0,4535.6086)"
gradientUnits="userSpaceOnUse" />
<filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Blur"
id="filter1432">
<feGaussianBlur
stdDeviation="10 10"
result="blur"
id="feGaussianBlur1430" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#0082c9"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2" inkscape:zoom="0.22627417" inkscape:cx="-541.25585" inkscape:cy="1016.1787"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="80"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" inkscape:window-width="1600" inkscape:window-height="835"
inkscape:window-x="0" inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:measure-start="0,0"
inkscape:measure-end="0,0"
showguides="true"
inkscape:guide-bbox="true" />
<metadata
id="metadata4550">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-454.12732,1199.2512)">
<rect
ry="26.458334"
rx="26.458334"
y="-1027.2244"
x="481.59952"
height="761.53064"
width="428.36118"
id="rect1400"
style="opacity:1;fill:#323232;fill-opacity:0.39215687;stroke:none;stroke-width:2.9104166;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:9.99999905;stroke-opacity:1;paint-order:markers fill stroke;filter:url(#filter1432)" />
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.9104166;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:9.99999905;stroke-opacity:1;paint-order:markers fill stroke"
id="rect1446"
width="428.36118"
height="761.53064"
x="481.59952"
y="-1027.2244"
rx="26.458334"
ry="26.458334" />
<image
xlink:href="{image}" width="382.17361" height="679.41968"
preserveAspectRatio="none" id="image4495" x="504.6933" y="-1005.3946" />
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.8;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:844.534729;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493-5" width="390.44183" height="449.6041"
x="502.9848" y="-820.65912" />
<flowRoot
xml:space="preserve"
id="flowRoot5145"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0.26458333,0,0,0.26458333,17.310326,-3058.0938)"><flowRegion
id="flowRegion5147"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"><rect
id="rect5149"
width="1824.2622"
height="142.40137"
x="1654.2856"
y="7244.0518"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:118.66667175px;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Bold';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowPara836">{heading}</flowPara></flowRoot>
<flowRoot
xml:space="preserve"
id="flowRoot5174"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
id="flowRegion5176"><rect
id="rect5178"
width="5.7142859"
height="57.142857"
x="177.14285"
y="480.14975" /></flowRegion><flowPara id="flowPara5180" /></flowRoot>
<flowRoot
transform="matrix(0.26458333,0,0,0.26458333,17.310326,-3021.0519)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowRoot845"
xml:space="preserve"><flowRegion
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowRegion837"><rect
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
y="7244.0518"
x="1654.2856"
height="151.77637"
width="1824.2622"
id="rect835" /></flowRegion><flowPara
id="flowPara843"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80px;font-family:'Open Sans';-inkscape-font-specification:'Open Sans';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">{subline}</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot856"
style="fill:black;fill-opacity:1;stroke:none;font-family:'Open Sans';font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'Open Sans';font-stretch:normal;font-variant:normal"><flowRegion
id="flowRegion858"><rect
id="rect860"
width="178.66393"
height="28.125"
x="1811.9611"
y="92.372047" /></flowRegion><flowPara
id="flowPara862" /></flowRoot> </g>
</svg>

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: 2019 Jan Borchardt
SPDX-FileCopyrightText: 2017-2018 Tobias Kaminsky <tobias@kaminsky.me>
SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="850mm" height="519mm"
viewBox="0 0 849.99998 519.00002" version="1.1" id="svg4553" inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="sevenInch.svg">
<defs
id="defs4547">
<linearGradient
inkscape:collect="always"
id="linearGradient832">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop828" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop830" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient832"
id="radialGradient836"
cx="2564.2764"
cy="7303.2788"
fx="2564.2764"
fy="7303.2788"
r="115.44445"
gradientTransform="matrix(1,0,0,0.37896268,0,4535.6086)"
gradientUnits="userSpaceOnUse" />
<filter style="color-interpolation-filters:sRGB"
inkscape:label="Blur"
id="filter1438">
<feGaussianBlur
stdDeviation="10 10"
result="blur"
id="feGaussianBlur1436" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#0082c9"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="0.32000001" inkscape:cx="850.68372" inkscape:cy="683.7239"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="80"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" inkscape:window-width="1600" inkscape:window-height="835"
inkscape:window-x="0" inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:measure-start="0,0"
inkscape:measure-end="0,0"
showguides="true" inkscape:guide-bbox="true" />
<metadata
id="metadata4550">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-205.9464,1011.8911)">
<flowRoot xml:space="preserve" id="flowRoot5174"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
id="flowRegion5176"><rect
id="rect5178"
width="5.7142859"
height="57.142857"
x="177.14285"
y="480.14975" /></flowRegion>
<flowPara id="flowPara5180" /></flowRoot>
<rect transform="matrix(0,1.0167232,-0.87178462,0,51.23532,10.618408)"
ry="28.895885"
rx="28.895885"
y="-1091.7408"
x="-868.86401"
height="831.68884"
width="467.82523"
id="rect1434"
style="opacity:1;fill:#323232;fill-opacity:0.39215686;stroke:none;stroke-width:2.91041636;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:9.99999905;stroke-opacity:1;paint-order:markers fill stroke;filter:url(#filter1438)" />
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.65647054;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:9.99999905;stroke-opacity:1;paint-order:markers fill stroke"
id="rect1446"
width="467.82523" height="692.88409"
x="-868.86401" y="-977.38843"
rx="28.895885" ry="24.073307"
transform="rotate(90)" />
<image sodipodi:absref="/home/tobi/projekt/nextcloud/android/scripts/screenshots/{image}"
xlink:href="{image}" y="-838.15137" x="360.16275"
id="image4525"
preserveAspectRatio="none" height="406.39999" width="541.86664" />
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.8;vector-effect:none;fill:#fff3f3;fill-opacity:1;stroke:none;stroke-width:377.62271118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493-2" width="541.86658" height="64.770226" x="360.16275" y="-838.15137" />
<rect
style="color:#000000;display:none;overflow:visible;visibility:visible;opacity:0.8;vector-effect:none;fill:#fffefe;fill-opacity:1;stroke:none;stroke-width:758.42236328;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4493-2-0" width="542.58588" height="260.91876" x="360.16275" y="-718.66608" />
<flowRoot
xml:space="preserve"
id="flowRoot5145-3"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0.26458333,0,0,0.26458333,-144.41453,-2883.2878)"><flowRegion
id="flowRegion5147-6"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"><rect
id="rect5149-7"
width="2550"
height="151.93109"
x="1655.498"
y="7245.5703"
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></flowRegion><flowPara
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:118.66667175px;font-family:'Open Sans';-inkscape-font-specification:'Open Sans Bold';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowPara836">{heading}</flowPara></flowRoot> <flowRoot
transform="matrix(0.26458333,0,0,0.26458333,-144.41453,-2845.1875)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:96px;line-height:125%;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowRoot845"
xml:space="preserve"><flowRegion
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowRegion837"><rect
style="text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
y="7242.4893"
x="1655.498"
height="159.96777"
width="2550"
id="rect835" /></flowRegion><flowPara
id="flowPara843"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80px;font-family:'Open Sans';-inkscape-font-specification:'Open Sans';text-align:center;text-anchor:middle;fill:#ffffff;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">{subline}</flowPara></flowRoot> </g>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: 2019 Jan Borchardt
SPDX-FileCopyrightText: 2017-2018 Tobias Kaminsky <tobias@kaminsky.me>
SPDX-License-Identifier: AGPL-3.0-or-later

25
scripts/updateLibraryHash.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2024 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
latestCommit=$(curl -s https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
currentCommit=$(grep "androidLibraryVersion" build.gradle | cut -f2 -d'"')
git fetch
git checkout master
git pull
[[ $latestCommit == "$currentCommit" ]] && exit # nothing to do
git fetch
git checkout -B update-library-"$(date +%F)" origin/master
sed -i s"#androidLibraryVersion\ =.*#androidLibraryVersion =\"$latestCommit\"#" build.gradle
./gradlew --console=plain --dependency-verification lenient -q --write-verification-metadata sha256,pgp help
git add build.gradle
git add gradle/verification-metadata.xml
git commit -s -m "Update library"
gh pr create --head "$(git branch --show-current)" --title "Update library $(date +%F)" --body "Update library to latest commit"

116
scripts/updateScreenshots.sh Executable file
View file

@ -0,0 +1,116 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019-2020 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
if [[ $(grep NC_TEST_SERVER_BASEURL ~/.gradle/gradle.properties | grep -v "#" -c) -gt 0 ]]; then
echo "This will not use server in docker. Please comment in .gradle/gradle.properties. Aborting!"
exit 1
fi
## emulator
if [[ ! $(emulator -list-avds | grep uiComparison -c) -eq 0 ]]; then
avdmanager delete avd -n uiComparison
(sleep 5; echo "no") | avdmanager create avd -n uiComparison -c 100M -k "system-images;android-27;google_apis;x86" --abi "google_apis/x86"
fi
if [ "$1" == "debug" ]; then
emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 1>/dev/null &
else
emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 1>/dev/null &
fi
PID=$!
## server
docker run --name=uiComparison nextcloudci/server --entrypoint '/usr/local/bin/initnc.sh' 1>/dev/null &
sleep 5
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' uiComparison)
if [[ $IP = "" ]]; then
echo "no server"
exit 1
fi
## wait for server to finish
scripts/wait_for_server.sh "$IP"
# setup test server
docker exec uiComparison /bin/sh -c "echo $IP server >> /etc/hosts"
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ user:setting user2 files quota 1G\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:add users\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user2\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable activity\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable text\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable end_to_end_encryption\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/circles.git /var/www/html/apps/circles/\""
#docker exec uiComparison /bin/sh -c "apt-get update; apt-get -y install composer"
#docker exec uiComparison /bin/sh -c "su www-data -c \"cd /var/www/html/apps/circles; composer install\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable -f circles\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 allow_non_ssl_links\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 local_is_non_ssl\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:system:set allow_local_remote_servers --value true --type bool\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ circles:manage:create test public publicCircle\""
docker exec uiComparison /bin/sh -c "/usr/local/bin/run.sh"
## wait for server to finish
scripts/wait_for_server.sh "$IP"
scripts/wait_for_emulator.sh
# change server to ip on emulator
adb root
sleep 2
adb remount
sleep 2
adb shell "mount -o remount,rw /system"
sleep 2
adb shell "echo $IP server >> /system/etc/hosts"
sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g app/src/main/res/values/setup.xml
## update/create all screenshots
#./gradlew gplayDebugExecuteScreenshotTests -Precord \
#-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest
## update screenshots in a class
#./gradlew gplayDebugExecuteScreenshotTests \
#-Precord \
#-Pandroid.testInstrumentationRunnerArguments.class=\
#com.owncloud.android.ui.dialog.SyncFileNotEnoughSpaceDialogFragmentTest
## update single screenshot within a class
#./gradlew gplayDebugExecuteScreenshotTests \
#-Precord \
#-Pandroid.testInstrumentationRunnerArguments.class=\
#com.nextcloud.client.FileDisplayActivityIT#showShares
resultCode=-1
retryCount=0
until [ $resultCode -eq 0 ] || [ $retryCount -gt 2 ]
do
# test all screenshots
./gradlew gplayDebugExecuteScreenshotTests \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest
resultCode=$?
((retryCount++))
done
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g app/src/main/res/values/setup.xml
if [ "$1" == "debug" ]; then
exit
fi
# tidy up
kill "$PID"
docker stop uiComparison
docker rm uiComparison

41
scripts/uploadArtifact.sh Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019-2022 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
#1: LOG_USERNAME
#2: LOG_PASSWORD
#3: DRONE_BUILD_NUMBER
#4: DRONE_PULL_REQUEST
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
source scripts/lib.sh
if ! test -e app/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_gh -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_gh -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
done
sudo 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 app/build/outputs/apk/qa/debug/qa-debug-*.apk
curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.png --upload-file $PR.png
curl_gh -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments -d "{ \"body\" : \"APK file: $PUBLIC_URL/$BUILD.apk <br/><br/> ![qrcode]($PUBLIC_URL/$BUILD.png) <br/><br/>To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app. \" }"

87
scripts/uploadReport.sh Executable file
View file

@ -0,0 +1,87 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2018-2022 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
upload() {
scripts/deleteOldComments.sh "$BRANCH" "$TYPE" "$PR"
cd $1
find . -type d -exec curl > /dev/null 2>&1 -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
find . -type f -exec curl > /dev/null 2>&1 -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
curl_gh -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
-d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
exit 1
}
#1: LOG_USERNAME
#2: LOG_PASSWORD
#3: DRONE_BUILD_NUMBER
#4: BRANCH (stable or master)
#5: TYPE (IT or Unit)
#6: DRONE_PULL_REQUEST
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
ID=$3
USER=$1
PASS=$2
BRANCH=$4
TYPE=$5
PR=$6
source scripts/lib.sh
REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
BRANCH_TYPE=$BRANCH-$TYPE
set -e
if [ -z $USER ] || [ -z $PASS ]; then
echo "USER or PASS is empty!"
exit 1
fi
if [ $TYPE = "IT" ]; then
FOLDER=app/build/reports/androidTests/connected/flavors/gplay
elif [ $TYPE = "Unit" ]; then
FOLDER=app/build/reports/tests/testGplayDebugUnitTest
else
FOLDER=app/build/reports/shot/gplay/debug/verification
fi
if [ -e $FOLDER ]; then
upload $FOLDER
else
scripts/deleteOldComments.sh "$BRANCH" "$TYPE" "$PR"
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
curl_gh > /dev/null 2>&1 \
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
-d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
if [ -e app/build/reports/androidTests/connected/flavors/gplay ] ; then
TYPE="IT"
BRANCH_TYPE=$BRANCH-$TYPE
upload "app/build/reports/androidTests/connected/flavors/gplay"
fi
if [ -e app/build/reports/tests/testGplayDebugUnitTest ] ; then
TYPE="Unit"
BRANCH_TYPE=$BRANCH-$TYPE
upload "app/build/reports/tests/testGplayDebugUnitTest"
fi
if [ -e app/build/reports/shot/gplay/debug/verification ] ; then
TYPE="Screenshot"
BRANCH_TYPE=$BRANCH-$TYPE
upload "app/build/reports/shot/gplay/debug/verification"
fi
exit 1 # always fail
fi

View file

@ -0,0 +1,21 @@
#!/bin/bash -x
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
#1: LOG_USERNAME
#2: LOG_PASSWORD
DAV_URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-screenshot-summary/
PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-screenshot-summary
USER=$1
PASS=$2
date=$(date +%F)
echo "Uploaded screenshot summary to $PUBLIC_URL/$date/summary.html"
cd app/build/screenshotSummary
find . -type d -exec curl > /dev/null 2>&1 -u $USER:$PASS -X MKCOL $DAV_URL/$date/$(echo {} | sed s#\./##) \;
find . -type f -exec curl > /dev/null 2>&1 -u $USER:$PASS -X PUT $DAV_URL/$date/$(echo {} | sed s#\./##) --upload-file {} \;

29
scripts/wait_for_emulator.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: 2021 Ralf Kistner <ralf@embarkmobile.com>
# SPDX-License-Identifier: CC0-1.0
#
# 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 5
done
echo "($checkcounter) Done"
adb -e shell input keyevent 82
echo "($checkcounter) Unlocked emulator screen"

24
scripts/wait_for_server.sh Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019-2020 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later
counter=0
status=""
until [[ $status = "false" ]]; do
status=$(curl 2>/dev/null "http://$1/status.php" | jq .maintenance)
echo "($counter) $status"
if [[ "$status" =~ "false" || "$status" = "" ]]; then
let "counter += 1"
if [[ $counter -gt 50 ]]; then
echo "Failed to wait for server"
exit 1
fi
fi
sleep 10
done