Skip to content

Automate updating screenshots #4575

Automate updating screenshots

Automate updating screenshots #4575

Workflow file for this run

name: Build & test
on:
push:
branches:
- main
- release-0.1.x
paths-ignore:
- '**.md'
pull_request:
workflow_dispatch:
jobs:
build:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
with:
lfs: 'true'
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Unit Tests
uses: gradle/gradle-build-action@v2
id: screenshotsverify
continue-on-error: true
with:
arguments: testDebug --rerun
- name: Prevent pushing new screenshots if this is a fork
id: checkfork
continue-on-error: false
if: steps.screenshotsverify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::Screenshot tests failed, please create a PR in your fork first." && exit 1
- name: Generate new screenshots if verification failed and it's a PR
id: screenshotsrecord
if: steps.screenshotsverify.outcome == 'failure' && github.event_name == 'pull_request'
run: |
./gradlew testDebug -P screenshot.record=repair
- name: Push new screenshots if available
uses: stefanzweifel/git-auto-commit-action@v4
if: steps.screenshotsrecord.outcome == 'success'
with:
file_pattern: '**/snapshots/images/*.png'
disable_globbing: true
commit_message: "🤖 Updates screenshots"
- name: Upload test results and reports
if: always()
uses: actions/upload-artifact@v3
with:
name: build-results
path: |
**/build/test-results/*
**/build/reports/*
**/out/*
compiletests:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
timeout-minutes: 50
env:
TERM: dumb
steps:
- uses: actions/checkout@v3
with:
lfs: 'true'
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Compile tests
uses: gradle/gradle-build-action@v2
with:
arguments: compileDebugAndroidTestSources
verify:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
with:
lfs: 'true'
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Check GIT lfs images
run: |
./scripts/git-lfs-check.sh
- name: Metalava compatibility check
uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace
metalavaCheckCompatibility metalavaCheckCompatibilityRelease
- name: Code analysis
uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace
spotlessCheck
lintDebug
- name: Dependencies analysis
uses: gradle/gradle-build-action@v2
if: ${{ false }} # Disabled until -android supported https://github.com/google/horologist/issues/1314
with:
arguments: --stacktrace
projectHealth