Skip to content
Merged
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
Binary file added .github/workflows/QA_keystore.jks
Binary file not shown.
2 changes: 2 additions & 0 deletions .github/workflows/QA_keystore.jks.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
4 changes: 1 addition & 3 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ jobs:
run: |
mkdir -p "$HOME/.gradle"
{
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
echo "org.gradle.caching=true"
echo "org.gradle.parallel=true"
echo "org.gradle.jvmargs=-Xmx5g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
echo "org.gradle.configureondemand=true"
echo "kapt.incremental.apt=true"
} > "$HOME/.gradle/gradle.properties"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9
uses: github/codeql-action/init@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
with:
languages: ${{ matrix.language }}
- name: Set up JDK 17
Expand All @@ -57,4 +57,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9
uses: github/codeql-action/analyze@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
58 changes: 58 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2023 Andy Scherzinger <info@andy-scherzinger.de>
# SPDX-License-Identifier: MIT
name: "QA"

on:
pull_request:
branches: [ main, master, stable-* ]

permissions:
pull-requests: write
contents: read

concurrency:
group: qa-build-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
qa:
runs-on: ubuntu-latest
steps:
- name: Check if secrets are available
run: echo "ok=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT"
id: check-secrets

- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
with:
persist-credentials: false

- name: set up JDK 17
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
with:
distribution: "temurin"
java-version: 17

- name: Build QA
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
env:
KS_PASS: ${{ secrets.KS_PASS }}
KEY_PASS: ${{ secrets.KEY_PASS }}
LOG_USERNAME: ${{ secrets.LOG_USERNAME }}
LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p $HOME/.gradle
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > $HOME/.gradle/gradle.properties
echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties
echo "org.gradle.parallel=true" >> $HOME/.gradle/gradle.properties
echo "org.gradle.configureondemand=true" >> $HOME/.gradle/gradle.properties
echo "kapt.incremental.apt=true" >> $HOME/.gradle/gradle.properties
sed -i "/qa/,/\}/ s/versionCode .*/versionCode ${{github.event.number}} /" app/build.gradle
sed -i "/qa/,/\}/ s/versionName .*/versionName \"${{github.event.number}}\"/" app/build.gradle
./gradlew assembleQaDebug
$(find /usr/local/lib/android/sdk/build-tools/*/apksigner | sort | tail -n1) sign --ks-pass pass:$KS_PASS --key-pass pass:$KEY_PASS --ks-key-alias key0 --ks .github/workflows/QA_keystore.jks app/build/outputs/apk/qa/debug/*qa-debug*.apk
.github/workflows/uploadArtifact.sh $LOG_USERNAME $LOG_PASSWORD ${{github.event.number}} ${{github.event.number}} $GITHUB_TOKEN
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9
uses: github/codeql-action/upload-sarif@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
with:
sarif_file: results.sarif
44 changes: 44 additions & 0 deletions .github/workflows/uploadArtifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/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 OR GPL-2.0-only
#

#1: LOG_USERNAME
#2: LOG_PASSWORD
#3: DRONE_BUILD_NUMBER
#4: DRONE_PULL_REQUEST


PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-artifacts
USER=$1
PASS=$2
BUILD=$3
PR=$4
GITHUB_TOKEN=$5
DAV_URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-artifacts/

source scripts/lib.sh
REPO=$(cat scripts/repo)

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/$REPO/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/$REPO/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/$REPO/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. \" }"
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ android {
play {
dimension "version"
}
qa {
applicationIdSuffix ".qa"
dimension "version"
versionCode 11
versionName "1"
}
}

testOptions {
Expand Down
13 changes: 13 additions & 0 deletions app/src/qa/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M15.919,9.768C16.095,9.592 16.095,9.3 15.919,9.134L14.866,8.08C14.7,7.905 14.408,7.905 14.232,8.08L13.404,8.904L15.092,10.591M7.95,14.362L7.95,16.05L9.637,16.05L14.614,11.068L12.927,9.381L7.95,14.362Z"
android:fillColor="@android:color/white" />
<path
android:pathData="m14.185,15.621q0,0.201 -0.065,0.373 -0.065,0.171 -0.187,0.297l0.367,0.359 -0.291,0.238 -0.399,-0.387q-0.082,0.029 -0.171,0.044 -0.088,0.017 -0.183,0.017 -0.41,0 -0.665,-0.267 -0.256,-0.267 -0.256,-0.675l0,-0.399q0,-0.407 0.254,-0.673 0.256,-0.268 0.665,-0.268 0.413,0 0.672,0.268 0.259,0.267 0.259,0.673zM13.74,15.219q0,-0.259 -0.129,-0.425 -0.129,-0.166 -0.356,-0.166 -0.227,0 -0.352,0.166 -0.125,0.164 -0.125,0.425l0,0.402q0,0.263 0.126,0.429 0.126,0.166 0.352,0.166 0.228,0 0.356,-0.166 0.128,-0.166 0.128,-0.429zM15.773,16.052L14.995,16.052L14.844,16.53L14.395,16.53L15.158,14.313l0.455,0l0.76,2.217l-0.449,0zM15.105,15.704l0.559,0L15.39,14.832l-0.009,0z"
android:strokeWidth="2.07924"
android:fillColor="#ffffff" />
</vector>
23 changes: 23 additions & 0 deletions app/src/qa/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Notes - Android Client
~
~ SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
~ SPDX-FileCopyrightText: 2020 Stefan Niedermann <info@niedermann.it>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_add_blue_24dp"
android:shortcutId="it.niedermann.owncloud.notes"
android:shortcutLongLabel="@string/shortcut_create_long"
android:shortcutShortLabel="@string/action_create"
tools:targetApi="n_mr1">
<intent
android:action="android.intent.action.CREATE_DOCUMENT"
android:targetClass="it.niedermann.owncloud.notes.edit.EditNoteActivity"
android:targetPackage="it.niedermann.owncloud.notes.qa" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>
1 change: 1 addition & 0 deletions scripts/repo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
notes-android
Loading