Skip to content

Commit 806c188

Browse files
🔄 synced local '.github/workflows/' with remote 'config/workflows/'
Signed-off-by: nextcloud-android-bot <[email protected]>
1 parent 96edde8 commit 806c188

File tree

6 files changed

+130
-0
lines changed

6 files changed

+130
-0
lines changed

.github/workflows/QA_keystore.jks

2.18 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
2+
SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only

.github/workflows/lib.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
#
3+
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
4+
# SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
5+
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
6+
#
7+
8+
## This file is intended to be sourced by other scripts
9+
10+
11+
function err() {
12+
echo >&2 "$@"
13+
}
14+
15+
16+
function curl_gh() {
17+
if [[ -n "$GITHUB_TOKEN" ]]
18+
then
19+
curl \
20+
--silent \
21+
--header "Authorization: token $GITHUB_TOKEN" \
22+
"$@"
23+
else
24+
err "WARNING: No GITHUB_TOKEN found. Skipping API call"
25+
fi
26+
27+
}

.github/workflows/lib.sh.license

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SPDX-FileCopyrightText: 2019-2025 Nextcloud GmbH and Nextcloud contributors
2+
SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only

.github/workflows/qa.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-FileCopyrightText: 2023 Andy Scherzinger <[email protected]>
3+
# SPDX-License-Identifier: MIT
4+
name: "QA"
5+
6+
on:
7+
pull_request:
8+
branches: [ main, master, stable-* ]
9+
10+
permissions:
11+
pull-requests: write
12+
contents: read
13+
14+
concurrency:
15+
group: qa-build-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
qa:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check if secrets are available
23+
run: echo "ok=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT"
24+
id: check-secrets
25+
26+
- name: Checkout
27+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
29+
with:
30+
persist-credentials: false
31+
32+
- name: set up JDK 17
33+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
34+
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
35+
with:
36+
distribution: "temurin"
37+
java-version: 17
38+
39+
- name: Build QA
40+
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
41+
env:
42+
KS_PASS: ${{ secrets.KS_PASS }}
43+
KEY_PASS: ${{ secrets.KEY_PASS }}
44+
LOG_USERNAME: ${{ secrets.LOG_USERNAME }}
45+
LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
mkdir -p "$HOME/.gradle"
49+
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > "$HOME/.gradle/gradle.properties"
50+
echo "org.gradle.caching=true; org.gradle.parallel=true; org.gradle.configureondemand=true; kapt.incremental.apt=true" >> "$HOME/.gradle/gradle.properties"
51+
sed -i "/qa/,/\}/ s/versionCode .*/versionCode ${{github.event.number}} /" "app/build.gradle"
52+
sed -i "/qa/,/\}/ s/versionName .*/versionName \"${{github.event.number}}\"/" "app/build.gradle"
53+
./gradlew assembleQaDebug
54+
$(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"
55+
.github/workflows/uploadArtifact.sh "$LOG_USERNAME" "$LOG_PASSWORD" "${{github.event.number}}" "${{github.event.number}}" "$GITHUB_TOKEN"

.github/workflows/uploadArtifact.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
5+
# SPDX-FileCopyrightText: 2019-2022 Tobias Kaminsky <[email protected]>
6+
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
7+
#
8+
9+
#1: LOG_USERNAME
10+
#2: LOG_PASSWORD
11+
#3: DRONE_BUILD_NUMBER
12+
#4: DRONE_PULL_REQUEST
13+
14+
15+
PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-artifacts
16+
USER=$1
17+
PASS=$2
18+
BUILD=$3
19+
PR=$4
20+
GITHUB_TOKEN=$5
21+
DAV_URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-artifacts/
22+
23+
source .github/workflows/lib.sh
24+
REPO=$(cat scripts/repo)
25+
26+
if ! test -e app/build/outputs/apk/qa/debug/*qa-debug*.apk ; then
27+
exit 1
28+
fi
29+
echo "Uploaded artifact to $DAV_URL/$BUILD.apk"
30+
31+
# delete all old comments, starting with "APK file:"
32+
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"|")
33+
34+
echo $oldComments | while read comment ; do
35+
curl_gh -X DELETE https://api.github.com/repos/nextcloud/$REPO/issues/comments/$comment
36+
done
37+
38+
sudo apt-get -y install qrencode
39+
40+
qrencode -o $PR.png "$PUBLIC_URL/$BUILD.apk"
41+
42+
curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.apk --upload-file app/build/outputs/apk/qa/debug/*qa-debug*.apk
43+
curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.png --upload-file $PR.png
44+
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. \" }"

0 commit comments

Comments
 (0)