name: Record screenshots on: workflow_dispatch: pull_request: types: [ labeled ] permissions: # Private fork: actions/checkout needs contents:read to clone. Upstream is public, # where an empty token can still read the repo, so an empty permissions block works there and # fails here with `fatal: repository not found`. contents: read # Enrich gradle.properties for CI/CD env: # Reduced from upstream's -Xmx8g / 4 GB Kotlin daemon for the self-hosted runners. # Each incus container reports 48 GiB and 8 cores, so a single build has ample room — # but the containers are oversubscribed against their host, and two concurrent heavy # Gradle jobs get their daemons SIGKILLed ("the daemon has disappeared", no # OutOfMemoryError, no heap dump). Running the same job alone succeeds. Lower heaps # make two builds likelier to coexist; the real fix is sizing the containers to the # host. See the "Report runner capacity" step. # Kept character-identical to tests.yml so the record path and the verify path cannot drift # apart again. These only affect the Gradle daemon — Paparazzi renders in forked test workers # configured entirely by build.gradle.kts — but keeping them aligned removes a whole class of # "did record and verify run the same way?" questions. GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx6g -XX:MaxMetaspaceSize=768m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options=-Xmx2g -XX:+UseG1GC CI_GRADLE_ARG_PROPERTIES: --stacktrace --no-daemon -Dsonar.gradle.skipCompile=true --no-configuration-cache --max-workers=4 jobs: record: permissions: # Need write permissions on PRs to remove the label "Record-Screenshots" pull-requests: write contents: write name: Record screenshots on branch ${{ github.event.pull_request.head.ref || github.ref_name }} runs-on: [self-hosted, Linux, X64] if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'Record-Screenshots' steps: - name: Free Disk Space (Ubuntu) # Only meaningful on GitHub's throwaway VMs. On a persistent self-hosted runner this # would delete dotnet/haskell/docker images from the host on every run. if: runner.environment == 'github-hosted' uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be with: # This might remove tools that are actually needed, if set to "true" but frees about 6 GB tool-cache: true # All of these default to true, but we should only need the 'android' one (and maybe swap-storage?) android: false dotnet: true haskell: true # This takes way too long to run (~2 minutes) and it saves only ~5.5GB large-packages: false docker-images: true swap-storage: false - name: Remove Record-Screenshots label if: github.event.label.name == 'Record-Screenshots' uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1.3.0 with: labels: Record-Screenshots - name: ⏬ Checkout with LFS (PR) if: github.event.label.name == 'Record-Screenshots' uses: nschloe/action-cached-lfs-checkout@385a8ecc719e50b8c71af6ab01a624b486b7c3bc # v1.2.5 with: persist-credentials: false ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }} - name: ⏬ Checkout with LFS (Branch) if: github.event_name == 'workflow_dispatch' uses: nschloe/action-cached-lfs-checkout@385a8ecc719e50b8c71af6ab01a624b486b7c3bc # v1.2.5 with: persist-credentials: false - name: ☕️ Use JDK 21 uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' # Add gradle cache, this should speed up the process - name: Configure gradle uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 with: cache-read-only: ${{ github.ref != 'refs/heads/develop' }} - name: Record screenshots id: record run: ./.github/workflows/scripts/recordScreenshots.sh env: GITHUB_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN || secrets.GITHUB_TOKEN }} # Must be the `github.repository` context, not a secret. There is no # GITHUB_REPOSITORY secret on this fork, so `secrets.GITHUB_REPOSITORY` expands to "" # and overrides the built-in env var of the same name — recordScreenshots.sh then # exits 1 with "No repo specified" before Gradle ever runs. GITHUB_REPOSITORY: ${{ github.repository }} GRADLE_ARGS: ${{ env.CI_GRADLE_ARG_PROPERTIES }}