Skip to content

Use workflow_run to trigger emulator.wtf tests#6864

Open
TimoPtr wants to merge 3 commits into
mainfrom
feature/emulator-wtf_fork_availability
Open

Use workflow_run to trigger emulator.wtf tests#6864
TimoPtr wants to merge 3 commits into
mainfrom
feature/emulator-wtf_fork_availability

Conversation

@TimoPtr
Copy link
Copy Markdown
Member

@TimoPtr TimoPtr commented May 19, 2026

Summary

Emulator.wtf currently can't run on PRs from forks. The authentication uses OIDC, which would require allowing anyone with a fork to authenticate against our Emulator.wtf account and we only want our own repo to be able to do that.

This PR adds a new PR Emulator.wtf workflow that is triggered by workflow_run once the main Pull Request workflow completes. Because workflow_run-triggered workflows always execute in the base-repo context (regardless of whether the PR comes from a fork), it can use OIDC credentials safely. The new workflow runs the Emulator.wtf jobs and takes over the test-results reporting that the original publish_test_results job used to handle.

Comment thread .github/workflows/pr.yml
@@ -340,42 +337,27 @@ jobs:
run: ./gradlew :app:assembleDebug :app:assembleAndroidTest -Pabis=x86,x86_64

- name: Build device list
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not move this step to the new workflow? There is no actual building happening in this step, and then we have less upload/download and untrusted input to deal with.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allow us to build the list of devices in a PR, otherwise we need to make a first PR to update the list since we execute the code from main not from the PR.

Copy link
Copy Markdown
Member

@jpelgrom jpelgrom May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use actions/checkout with a reference to the PR branch, no? That also works for forks based on what I can find. We don't actually use the files in the new workflow so no conflict.

Snippet I found, ref/repository should be changed to use github.event.workflow_run:

- name: Clone repository
  uses: actions/checkout
  with:
    fetch-depth: 0
    ref: ${{github.event.pull_request.head.ref}}
    repository: ${{github.event.pull_request.head.repo.full_name}}

@TimoPtr TimoPtr marked this pull request as ready for review May 20, 2026 06:50
@TimoPtr TimoPtr requested review from Copilot and jpelgrom May 20, 2026 06:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves Emulator.wtf instrumentation testing out of the main Pull Request workflow into a new workflow_run-triggered workflow so Emulator.wtf OIDC auth can run safely for PRs coming from forks, while still publishing aggregated test results back to the PR.

Changes:

  • Replaced the in-workflow Emulator.wtf execution with a build-only job that uploads APKs + a device list as an artifact.
  • Added a new PR Emulator.wtf workflow triggered by workflow_run to download those inputs, run Emulator.wtf tests, and upload results.
  • Moved test-result publication (EnricoMi) from pr.yml into the new workflow to aggregate both PR-workflow and Emulator.wtf results.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/pr.yml Removes direct Emulator.wtf execution and instead builds/uploads Emulator.wtf inputs (APKs + devices.txt); removes in-workflow results publication.
.github/workflows/pr-emulator-wtf.yml New workflow that runs Emulator.wtf after Pull Request completes and publishes aggregated test results back to the PR.
Comments suppressed due to low confidence (1)

.github/workflows/pr-emulator-wtf.yml:127

  • This step unconditionally downloads the Instrumentation Test app results artifact from the current run. If the emulator_wtf job was skipped (or exited early before uploading artifacts), this download will fail and prevent publishing the results produced by pr.yml.

Make this download conditional (for example only when needs.emulator_wtf.result == 'success') or otherwise handle the missing-artifact case gracefully.

      - name: Download emulator.wtf results from this run
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: Instrumentation Test app results
          path: pr-artifacts/Instrumentation Test app results

Comment thread .github/workflows/pr-emulator-wtf.yml
Comment on lines +57 to +60
if [[ ! "$line" =~ ^model=Pixel7,version=(2[3-9]|3[0-9]|40)$ ]]; then
echo "::error::Invalid line in devices.txt"
exit 1
fi
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpelgrom I didn't know what to do there that's why I kept an acceptable range [23-40]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants