diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 2b28879c..f02e4712 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -89,7 +89,7 @@ jobs: - name: Compare screenshots if: ${{ always() }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CLASSIC_TOKEN: ${{ secrets.GITHUB_TOKEN }} emulatorApi: ${{ matrix.emulatorApi }} run: | ls -ls extendedSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected @@ -97,7 +97,7 @@ jobs: export DISPLAY=:99 sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & echo ${{ env.resourceRunID }} - ./screenShotCompare.sh ${{ env.resourceRunID }} + ./screenShotScript/screenShotCompare.sh ${{ env.resourceRunID }} - name: Archive screenshots diffs ${{ matrix.emulatorApi }} if: ${{ always() }} uses: actions/upload-artifact@v4 diff --git a/.gitmodules b/.gitmodules index 9d36ff31..4d332661 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "git-diff-image"] path = git-diff-image url = git@github.com:ewanmellor/git-diff-image.git +[submodule "screenShotScript"] + path = screenShotScript + url = git@github.com:hannesa2/screenShotScript.git diff --git a/screenShotCompare.sh b/screenShotCompare.sh deleted file mode 100755 index 063213da..00000000 --- a/screenShotCompare.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -diffFiles=./screenshotDiffs -mkdir $diffFiles -set -x -./git-diff-image/install.sh -GIT_DIFF_IMAGE_OUTPUT_DIR=$diffFiles git diff-image - -source scripts/lib.sh - -PR=$(echo "$GITHUB_REF_NAME" | sed "s/\// /" | awk '{print $1}') -echo pr=$PR -brew install jq - -echo "delete all old comments, starting with Screenshot differs:$emulatorApi" -oldComments=$(curl_gh -X GET https://api.github.com/repos/"$GITHUB_REPOSITORY"/issues/"$PR"/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("github-actions") | tostring) + "|" + (.body | test("Screenshot differs:'$emulatorApi'.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|") -echo "comments=$comments" -echo "$oldComments" | while read comment; do - echo "delete comment=$comment" - curl_gh -X DELETE https://api.github.com/repos/"$GITHUB_REPOSITORY"/issues/comments/"$comment" -done - -pushd $diffFiles -body="" -COUNTER=0 -ls -la - -# ignore an error, when no files where found https://unix.stackexchange.com/a/723909/201876 -setopt no_nomatch -for f in *.png; do - if [[ ${f} == "*.png" ]] - then - echo "nothing found" - else - (( COUNTER++ )) - - newName="$1-${f}" - mv "${f}" "$newName" - echo "==> Uploaded screenshot $newName" - curl -i -F "file=@$newName" https://www.mxtracks.info/github - echo "==> Add screenshot comment $PR" - body="$body ${f}![screenshot](https://www.mxtracks.info/github/uploads/$newName)

" - fi -done - -if [ ! "$body" == "" ]; then - curl_gh -X POST https://api.github.com/repos/"$GITHUB_REPOSITORY"/issues/$PR/comments -d "{ \"body\" : \"Screenshot differs:$emulatorApi $COUNTER

$body \" }" -fi - -popd 1>/dev/null - -# set error when diffs are there -[ "$(ls -A $diffFiles)" ] && exit 1 || exit 0 diff --git a/screenShotScript b/screenShotScript new file mode 160000 index 00000000..fe15efbe --- /dev/null +++ b/screenShotScript @@ -0,0 +1 @@ +Subproject commit fe15efbeefab9b8006d14d1a78b89e6ebfb5befb diff --git a/screenshotsToCompare14/ExtendedMainTest_mainSmokeTest-End.png b/screenshotsToCompare14/ExtendedMainTest_mainSmokeTest-End.png index 0086d6c8..d2d1b0e4 100644 Binary files a/screenshotsToCompare14/ExtendedMainTest_mainSmokeTest-End.png and b/screenshotsToCompare14/ExtendedMainTest_mainSmokeTest-End.png differ