From a384690081097fe8b255a603b647c1da3b235611 Mon Sep 17 00:00:00 2001 From: jocoand Date: Thu, 26 Dec 2024 10:09:13 +0700 Subject: [PATCH] Add workflow --- .github/workflows/store-screenshots.yml | 51 +++++++++++++++++ .github/workflows/verify-screenshot-test.yml | 58 ++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/workflows/store-screenshots.yml create mode 100644 .github/workflows/verify-screenshot-test.yml diff --git a/.github/workflows/store-screenshots.yml b/.github/workflows/store-screenshots.yml new file mode 100644 index 0000000..d2d078e --- /dev/null +++ b/.github/workflows/store-screenshots.yml @@ -0,0 +1,51 @@ +name: store screenshots + +on: + workflow_dispatch + +env: + GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx6g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" + +jobs: + test: + runs-on: macos-latest + + permissions: + contents: read + actions: write + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3.9.0 + with: + distribution: 'zulu' + java-version: 19 + + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + + - name: test + run: | + # Create screenshots + ./gradlew app:recordRoborazziDebug --stacktrace + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: screenshot + path: app/build/outputs/roborazzi + retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: screenshot-reports + path: app/build/reports + retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: screenshot-test-results + path: app/build/test-results + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/verify-screenshot-test.yml b/.github/workflows/verify-screenshot-test.yml new file mode 100644 index 0000000..06c0480 --- /dev/null +++ b/.github/workflows/verify-screenshot-test.yml @@ -0,0 +1,58 @@ +name: screenshot test + +on: + push + +env: + GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx6g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" + +jobs: + test: + runs-on: macos-latest + + permissions: + contents: read + actions: write + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3.9.0 + with: + distribution: 'zulu' + java-version: 19 + + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + + - uses: dawidd6/action-download-artifact@v3 + with: + name: screenshot + path: app/build/outputs/roborazzi + workflow: store-screenshots.yml + branch: main + + - name: verify test + id: verify-test + run: | + ./gradlew app:verifyRoborazziDebug --stacktrace + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: screenshot-diff + path: app/build/outputs/roborazzi + retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: screenshot-diff-reports + path: app/build/reports + retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: screenshot-diff-test-results + path: app/build/test-results + retention-days: 30 \ No newline at end of file