Pin screenshot dimensions to fixed dp size #197
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android Screenshot Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| screenshot-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build rn-storybook-auto-screenshots | |
| run: npm run build | |
| working-directory: packages/rn-storybook-auto-screenshots | |
| - name: Run package tests | |
| run: npm test | |
| working-directory: packages/rn-storybook-auto-screenshots | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| with: | |
| cache-read-only: false | |
| - name: Enable Gradle caching | |
| run: | | |
| mkdir -p ~/.gradle | |
| echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties | |
| echo "org.gradle.parallel=true" >> ~/.gradle/gradle.properties | |
| echo "org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m" >> ~/.gradle/gradle.properties | |
| - name: Install eaase | |
| run: curl https://eaase.dev/installer.sh | sh | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| android/.gradle | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Run Android unit tests | |
| run: ./android/gradlew -p android :rn-storybook-auto-screenshots:test | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/share/boost | |
| df -h | |
| - name: Build only x86_64 for emulator tests | |
| run: | | |
| echo "reactNativeArchitectures=x86_64" >> android/gradle.properties | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-26 | |
| - name: Run screenshot tests | |
| env: | |
| EAASE_API_TOKEN: ${{ secrets.EAASE_API_TOKEN }} | |
| SCREENSHOTBOT_API_KEY: ${{ secrets.SCREENSHOTBOT_API_KEY }} | |
| SCREENSHOTBOT_API_SECRET: ${{ secrets.SCREENSHOTBOT_API_SECRET }} | |
| run: | | |
| # Prebuild the binaries before requesting the emulator | |
| ./android/gradlew -p android :app:assembleDebugAndroidTest | |
| ~/eaase/eaase run --api-level 33 -- ./android/gradlew -p android :app:recordAndVerifyDebugScreenshotbotCI | |