mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 10:49:04 +03:00
Merge pull request #8936 from nextcloud/minor-script-improvements
Minor script improvements
This commit is contained in:
commit
7baa1aa697
7 changed files with 20 additions and 44 deletions
|
@ -26,11 +26,11 @@ steps:
|
||||||
- ./gradlew assembleGplayDebug
|
- ./gradlew assembleGplayDebug
|
||||||
- scripts/wait_for_emulator.sh
|
- scripts/wait_for_emulator.sh
|
||||||
- scripts/deleteOutdatedComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
- scripts/deleteOutdatedComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||||
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||||
- ./gradlew installGplayDebugAndroidTest
|
- ./gradlew installGplayDebugAndroidTest
|
||||||
- scripts/wait_for_server.sh "server"
|
- scripts/wait_for_server.sh "server"
|
||||||
- scripts/deleteOutdatedComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
- scripts/deleteOutdatedComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||||
- ./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
- ./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||||
- ./gradlew combinedTestReport
|
- ./gradlew combinedTestReport
|
||||||
- name: notify
|
- name: notify
|
||||||
image: drillster/drone-email
|
image: drillster/drone-email
|
||||||
|
|
2
.github/workflows/screenShotTest.yml
vendored
2
.github/workflows/screenShotTest.yml
vendored
|
@ -23,8 +23,6 @@ jobs:
|
||||||
mkdir -p $HOME/.gradle
|
mkdir -p $HOME/.gradle
|
||||||
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties
|
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties
|
||||||
./gradlew assembleGplayDebug
|
./gradlew assembleGplayDebug
|
||||||
- name: Delete old comments
|
|
||||||
run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: run tests
|
- name: run tests
|
||||||
uses: reactivecircus/android-emulator-runner@v2
|
uses: reactivecircus/android-emulator-runner@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "1: record: true/false
|
echo "1: record: true/false
|
||||||
|
@ -58,7 +59,7 @@ while read line ; do
|
||||||
done < <(adb devices | cut -f1)
|
done < <(adb devices | cut -f1)
|
||||||
|
|
||||||
if [ "$emulatorIsRunning" == false ] ; then
|
if [ "$emulatorIsRunning" == false ] ; then
|
||||||
emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 &
|
"$(command -v emulator)" -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $5 ] ; then
|
if [ -e $5 ] ; then
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
#1: LOG_USERNAME
|
|
||||||
#2: LOG_PASSWORD
|
|
||||||
#3: DRONE_BUILD_NUMBER
|
|
||||||
#4: BRANCH (stable or master)
|
|
||||||
#5: TYPE (IT or Unit)
|
|
||||||
#6: DRONE_PULL_REQUEST
|
|
||||||
#7: GITHUB_TOKEN
|
|
||||||
|
|
||||||
BRANCH=$1
|
|
||||||
TYPE=$2
|
|
||||||
PR=$3
|
|
||||||
GITHUB_USER=$4
|
|
||||||
GITHUB_PASSWORD=$5
|
|
||||||
BRANCH_TYPE=$BRANCH-$TYPE
|
|
||||||
|
|
||||||
# delete all old comments, matching this type
|
|
||||||
echo "Deleting old comments for $BRANCH_TYPE"
|
|
||||||
oldComments=$(curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -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") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
|
||||||
count=$(echo $oldComments | grep true | wc -l)
|
|
||||||
echo "Found $count old comments"
|
|
||||||
|
|
||||||
echo $oldComments | while read comment ; do
|
|
||||||
echo "Deleting comment: $comment"
|
|
||||||
curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
|
||||||
done
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -43,7 +43,7 @@ do
|
||||||
&& scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \
|
&& scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \
|
||||||
"$GIT_USERNAME" "$GIT_TOKEN" \
|
"$GIT_USERNAME" "$GIT_TOKEN" \
|
||||||
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
|
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
|
||||||
"$1-$darkMode-$color" "Screenshot" "$4" "$GIT_USERNAME" "$GIT_TOKEN"
|
"$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN"
|
||||||
fi
|
fi
|
||||||
done < scripts/screenshotCombinations
|
done < scripts/screenshotCombinations
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ scripts/wait_for_emulator.sh
|
||||||
stat=$?
|
stat=$?
|
||||||
|
|
||||||
if [ ! $stat -eq 0 ]; then
|
if [ ! $stat -eq 0 ]; then
|
||||||
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./gradlew installGplayDebugAndroidTest
|
./gradlew installGplayDebugAndroidTest
|
||||||
|
@ -27,7 +27,7 @@ scripts/wait_for_server.sh "server"
|
||||||
stat=$(( stat | $? ))
|
stat=$(( stat | $? ))
|
||||||
|
|
||||||
if [ ! $stat -eq 0 ]; then
|
if [ ! $stat -eq 0 ]; then
|
||||||
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./gradlew combinedTestReport
|
./gradlew combinedTestReport
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
curl_gh() {
|
||||||
|
curl \
|
||||||
|
--header "authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
deleteOldComments() {
|
deleteOldComments() {
|
||||||
# delete all old comments, matching this type
|
# delete all old comments, matching this type
|
||||||
echo "Deleting old comments for $BRANCH_TYPE"
|
echo "Deleting old comments for $BRANCH_TYPE"
|
||||||
oldComments=$(curl > /dev/null 2>&1 -u $GITHUB_USER:$GITHUB_PASSWORD -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") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
oldComments=$(curl_gh > /dev/null 2>&1 -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") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||||
count=$(echo $oldComments | grep true | wc -l)
|
count=$(echo $oldComments | grep true | wc -l)
|
||||||
echo "Found $count old comments"
|
echo "Found $count old comments"
|
||||||
|
|
||||||
echo $oldComments | while read comment ; do
|
echo $oldComments | while read comment ; do
|
||||||
echo "Deleting comment: $comment"
|
echo "Deleting comment: $comment"
|
||||||
curl > /dev/null 2>&1 -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
curl_gh > /dev/null 2>&1 -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +29,7 @@ upload() {
|
||||||
|
|
||||||
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
|
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
|
||||||
|
|
||||||
curl -u $GITHUB_USER:$GITHUB_PASSWORD -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
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 \" }"
|
-d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -35,8 +41,7 @@ upload() {
|
||||||
#4: BRANCH (stable or master)
|
#4: BRANCH (stable or master)
|
||||||
#5: TYPE (IT or Unit)
|
#5: TYPE (IT or Unit)
|
||||||
#6: DRONE_PULL_REQUEST
|
#6: DRONE_PULL_REQUEST
|
||||||
#7: GIT_USERNAME
|
#7: GITHUB_TOKEN
|
||||||
#8: GIT_TOKEN
|
|
||||||
|
|
||||||
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
|
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
|
||||||
ID=$3
|
ID=$3
|
||||||
|
@ -45,8 +50,8 @@ PASS=$2
|
||||||
BRANCH=$4
|
BRANCH=$4
|
||||||
TYPE=$5
|
TYPE=$5
|
||||||
PR=$6
|
PR=$6
|
||||||
GITHUB_USER=$7
|
GITHUB_TOKEN="$7"
|
||||||
GITHUB_PASSWORD=$8
|
|
||||||
REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
|
REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
|
||||||
BRANCH_TYPE=$BRANCH-$TYPE
|
BRANCH_TYPE=$BRANCH-$TYPE
|
||||||
|
|
||||||
|
@ -71,7 +76,7 @@ else
|
||||||
deleteOldComments
|
deleteOldComments
|
||||||
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
|
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
|
||||||
|
|
||||||
curl > /dev/null 2>&1 -u $GITHUB_USER:$GITHUB_PASSWORD \
|
curl_gh > /dev/null 2>&1 \
|
||||||
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
-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. \" }"
|
-d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue