2024-03-29 18:56:51 +03:00
|
|
|
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
|
2024-04-30 13:16:39 +03:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
2024-03-29 18:56:51 +03:00
|
|
|
|
2021-02-23 19:28:11 +03:00
|
|
|
name: "Screenshot Test"
|
2020-09-25 12:53:09 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2021-01-05 16:42:56 +03:00
|
|
|
branches: [ master, stable-* ]
|
2020-09-25 12:53:09 +03:00
|
|
|
|
2022-06-10 09:03:43 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
|
|
|
|
2024-02-22 12:13:22 +03:00
|
|
|
concurrency:
|
2023-06-08 14:53:06 +03:00
|
|
|
group: screenshot-test-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-09-25 12:53:09 +03:00
|
|
|
jobs:
|
2021-02-23 19:28:11 +03:00
|
|
|
screenshot:
|
2024-04-26 15:52:46 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-02-23 19:28:11 +03:00
|
|
|
strategy:
|
2021-02-23 22:04:34 +03:00
|
|
|
fail-fast: false
|
2021-02-23 19:28:11 +03:00
|
|
|
matrix:
|
2021-07-15 10:00:38 +03:00
|
|
|
scheme: [ Light ]
|
|
|
|
color: [ blue ]
|
2022-01-12 10:57:22 +03:00
|
|
|
api-level: [ 27 ]
|
2020-09-25 12:53:09 +03:00
|
|
|
steps:
|
2024-06-13 22:39:30 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2022-01-12 10:57:22 +03:00
|
|
|
|
|
|
|
- name: Gradle cache
|
2024-03-21 01:37:25 +03:00
|
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
2022-01-12 10:57:22 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.gradle/caches
|
|
|
|
~/.gradle/wrapper
|
|
|
|
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
|
|
|
- name: AVD cache
|
2024-03-21 01:37:25 +03:00
|
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
2022-01-12 10:57:22 +03:00
|
|
|
id: avd-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.android/avd/*
|
|
|
|
~/.android/adb*
|
|
|
|
key: avd-${{ matrix.api-level }}
|
|
|
|
|
2024-03-16 19:16:44 +03:00
|
|
|
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
|
2020-09-25 12:53:09 +03:00
|
|
|
with:
|
2022-01-20 12:37:32 +03:00
|
|
|
distribution: "temurin"
|
2023-05-08 19:35:05 +03:00
|
|
|
java-version: 17
|
2022-01-12 10:57:22 +03:00
|
|
|
|
2024-04-26 15:52:46 +03:00
|
|
|
- name: Enable KVM group perms
|
|
|
|
run: |
|
|
|
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
|
|
|
sudo udevadm control --reload-rules
|
|
|
|
sudo udevadm trigger --name-match=kvm
|
|
|
|
|
2022-01-12 10:57:22 +03:00
|
|
|
- name: create AVD and generate snapshot for caching
|
|
|
|
if: steps.avd-cache.outputs.cache-hit != 'true'
|
2024-06-25 11:19:02 +03:00
|
|
|
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # v2.31.0
|
2022-01-12 10:57:22 +03:00
|
|
|
with:
|
|
|
|
api-level: ${{ matrix.api-level }}
|
|
|
|
force-avd-creation: false
|
|
|
|
arch: x86
|
|
|
|
sdcard-path-or-size: 100M
|
|
|
|
target: google_apis
|
|
|
|
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
|
|
|
|
script: echo "Generated AVD snapshot for caching."
|
|
|
|
|
|
|
|
- name: Configure gradle daemon
|
2020-09-25 12:53:09 +03:00
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/.gradle
|
|
|
|
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties
|
2022-01-12 10:57:22 +03:00
|
|
|
echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties
|
|
|
|
|
|
|
|
- name: Build gplay
|
|
|
|
run: ./gradlew assembleGplayDebug
|
|
|
|
|
2021-09-10 16:33:13 +03:00
|
|
|
- name: Delete old comments
|
2022-05-31 11:07:03 +03:00
|
|
|
env:
|
2022-12-16 12:18:51 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-09-21 13:04:18 +03:00
|
|
|
if: ${{ always() }}
|
2022-05-31 11:07:03 +03:00
|
|
|
run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
|
2022-01-12 10:57:22 +03:00
|
|
|
|
|
|
|
- name: Run screenshot tests
|
2024-02-22 12:13:22 +03:00
|
|
|
env:
|
|
|
|
SHOT_TEST: "true"
|
2024-06-25 11:19:02 +03:00
|
|
|
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # v2.31.0
|
2020-09-25 12:53:09 +03:00
|
|
|
with:
|
2022-01-12 10:57:22 +03:00
|
|
|
api-level: ${{ matrix.api-level }}
|
|
|
|
force-avd-creation: false
|
|
|
|
arch: x86
|
|
|
|
sdcard-path-or-size: 100M
|
|
|
|
target: google_apis
|
2020-09-25 12:53:09 +03:00
|
|
|
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
|
2023-06-07 13:40:40 +03:00
|
|
|
script: ./gradlew uninstallAll gplayDebugExecuteScreenshotTests -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" -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest -Pandroid.testInstrumentationRunnerArguments.COLOR=${{ matrix.color }} -Pandroid.testInstrumentationRunnerArguments.DARKMODE=${{ matrix.scheme }}
|
2020-09-25 12:53:09 +03:00
|
|
|
- name: upload failing results
|
|
|
|
if: ${{ failure() }}
|
2022-05-31 11:07:03 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-12-16 12:18:51 +03:00
|
|
|
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
|
2021-02-24 15:43:14 +03:00
|
|
|
- name: Archive Espresso results
|
2024-04-22 22:31:00 +03:00
|
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
2021-02-24 15:43:14 +03:00
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
|
|
|
name: Report-${{ matrix.color }}-${{ matrix.scheme }}
|
2022-03-11 13:14:46 +03:00
|
|
|
path: app/build/reports
|
2021-02-26 12:55:11 +03:00
|
|
|
retention-days: 4
|