Files
callstack__agent-device/.github/actions/setup-apple-replay/action.yml
T
Michał Pierzchała e58cbcdb5f refactor: colocate native platform sources under android/, apple/, linux/ (#1273)
Move the scattered root-level native projects into per-platform folders and drop
the now-redundant platform prefix:

- android-ime-helper/        -> android/ime-helper/
- android-multitouch-helper/ -> android/multitouch-helper/
- android-snapshot-helper/   -> android/snapshot-helper/
- apple-runner/              -> apple/runner/
- macos-helper/              -> apple/macos-helper/
- src/platforms/linux/atspi-dump.py -> linux/atspi-dump.py

Only repo source paths move. Identity surfaces stay frozen so no user's runner
cache is invalidated on upgrade: the derived-cache key hashes source paths
relative to AgentDeviceRunner and excludes packageVersion, and the
~/.agent-device/{apple-runner,macos-helper} namespaces, the
agent-device-android-*-helper artifact/manifest/protocol names, the
AgentDeviceRunner Xcode project, and the `prepare ios-runner` CLI command are
unchanged. Updates build/package scripts, CI, package.json files+scripts,
ignore/attr/fallow configs, runtime path resolvers, and test fixtures.

Also: re-base repo-root-relative refs inside the moved apple/runner for the
added nesting level (gated XCUITest fixture walk + two doc links), and clean the
legacy dist/apple-runner packaged output so the relocated runner can't
double-ship into the wholesale-included dist (with a regression test).
2026-07-15 21:47:38 +02:00

78 lines
3.0 KiB
YAML

name: "Setup Apple Replay"
description: "Resolve shared Apple replay cache/build state and expose the agent-device home path"
inputs:
derived-path:
description: "Derived data path used by the replay runner"
required: true
cache-key-prefix:
description: "Prefix for the cache key"
required: true
cache-key-suffix:
description: "Optional suffix for the cache key"
required: false
default: ""
build-command:
description: "Command used to refresh replay artifacts before use"
required: true
xcuitest-platform:
description: "Optional AGENT_DEVICE_XCUITEST_PLATFORM value"
required: false
default: ""
xcuitest-destination:
description: "Optional AGENT_DEVICE_XCUITEST_DESTINATION value"
required: false
default: ""
build-before-use:
description: "Whether this setup action should refresh replay artifacts after restoring the cache"
required: false
default: "true"
outputs:
agent-home-dir:
description: "Resolved agent-device home directory"
value: ${{ steps.agent-home.outputs.dir }}
cache-hit:
description: "Whether a replay cache was restored before any build refresh"
value: ${{ steps.restore-prebuilt.outputs.cache-hit }}
runs:
using: "composite"
steps:
- name: Resolve Xcode cache key
id: xcode
run: |
set -euo pipefail
XCODE_VERSION="$(xcodebuild -version | tr '\n' ' ' | sed -E 's/[[:space:]]+/ /g; s/[[:space:]]$//')"
XCODE_KEY="$(echo "$XCODE_VERSION" | tr ' ' '-' | tr -cd '[:alnum:]._-')"
echo "key=$XCODE_KEY" >> "$GITHUB_OUTPUT"
shell: bash
- name: Resolve prebuild source hash
id: source-hash
run: |
set -euo pipefail
echo "value=${{ hashFiles('apple/runner/**', 'scripts/build-xcuitest-apple.sh', 'scripts/patch-xcuitest-runner-icon.ts', 'scripts/write-xcuitest-cache-metadata.mjs', 'src/platforms/ios/apple-runner-platform.ts', 'src/platforms/ios/runner-icon.ts', 'src/platforms/ios/runner-xctestrun.ts', 'src/platforms/ios/runner-xctestrun-products.ts', '.github/actions/setup-apple-replay/action.yml', 'package.json', 'pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Cache replay prebuilt
id: restore-prebuilt
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
with:
path: ${{ inputs.derived-path }}
key: ${{ inputs.cache-key-prefix }}-${{ steps.xcode.outputs.key }}${{ inputs.cache-key-suffix }}-${{ steps.source-hash.outputs.value }}
- name: Resolve agent-device home
id: agent-home
run: echo "dir=${AGENT_DEVICE_STATE_DIR:-$HOME/.agent-device}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Build replay artifacts
if: inputs.build-before-use == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH: ${{ inputs.derived-path }}
AGENT_DEVICE_XCUITEST_PLATFORM: ${{ inputs.xcuitest-platform }}
AGENT_DEVICE_XCUITEST_DESTINATION: ${{ inputs.xcuitest-destination }}