Skip to content

Merge pull request #15 from droidrun/timo/fix-prebuild-r2-tunnel #2

Merge pull request #15 from droidrun/timo/fix-prebuild-r2-tunnel

Merge pull request #15 from droidrun/timo/fix-prebuild-r2-tunnel #2

Workflow file for this run

name: Prebuild & Publish WDA to R2
# Builds the prebuilt WebDriverAgentRunner artifacts (the same six zips the
# manual wda-package.yml produced) and mirrors them to Cloudflare R2 under
# releases/mobilerun-wda/, following the droidrun-ios release/preview pattern:
#
# release published -> releases/mobilerun-wda/<tag>/ + releases/mobilerun-wda/latest/
# push to master -> releases/mobilerun-wda/preview/
# workflow_dispatch -> preview/ when run from master, build-only otherwise
#
# Builds are unsigned (CODE_SIGNING_ALLOWED=NO in Scripts/ci/build-*.sh); the
# runner is signed at install time. Requires these repo Secrets/Variables:
# secrets: R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY
# vars: R2_BUCKET
on:
release:
types: [published]
push:
branches: [master]
workflow_dispatch:
concurrency:
group: prebuild-r2-${{ github.ref }}
# Never cancel a release build; superseded preview builds can be dropped.
cancel-in-progress: ${{ github.event_name != 'release' }}
env:
XCODE_VERSION: "16.4"
DESTINATION_SIM: platform=iOS Simulator,name=iPhone 17
DESTINATION_SIM_tvOS: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
jobs:
build-real:
name: Build ${{ matrix.scheme }} (real device)
runs-on: macos-15
strategy:
fail-fast: false
matrix:
include:
- scheme: WebDriverAgentRunner
destination: generic/platform=iOS
derived_data: appium_wda_ios
wd: appium_wda_ios/Build/Products/Debug-iphoneos
zip: WebDriverAgentRunner-Runner.zip
ios: true
- scheme: WebDriverAgentRunner_tvOS
destination: generic/platform=tvOS
derived_data: appium_wda_tvos
wd: appium_wda_tvos/Build/Products/Debug-appletvos
zip: WebDriverAgentRunner_tvOS-Runner.zip
ios: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ env.XCODE_VERSION }}"
- name: Build & zip ${{ matrix.scheme }}-Runner.app
run: sh "$GITHUB_WORKSPACE/Scripts/ci/build-real.sh"
env:
DERIVED_DATA_PATH: ${{ matrix.derived_data }}
SCHEME: ${{ matrix.scheme }}
DESTINATION: ${{ matrix.destination }}
WD: ${{ matrix.wd }}
ZIP_PKG_NAME: ${{ matrix.zip }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.scheme }}-Runner
path: ${{ matrix.zip }}
if-no-files-found: error
build-sim:
name: Build WebDriverAgentRunner${{ matrix.target }} sim (${{ matrix.arch }})
runs-on: macos-15
strategy:
fail-fast: false
matrix:
include:
- target: ""
arch: x86_64
sim_dir: Debug-iphonesimulator
ios: true
- target: ""
arch: arm64
sim_dir: Debug-iphonesimulator
ios: true
- target: "_tvOS"
arch: x86_64
sim_dir: Debug-appletvsimulator
ios: false
- target: "_tvOS"
arch: arm64
sim_dir: Debug-appletvsimulator
ios: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ env.XCODE_VERSION }}"
- name: Build & zip WebDriverAgentRunner${{ matrix.target }} (simulator)
run: |
DESTINATION="$DESTINATION_SIM${{ matrix.target }}" sh "$GITHUB_WORKSPACE/Scripts/ci/build-sim.sh"
env:
SCHEME: WebDriverAgentRunner${{ matrix.target }}
ARCHS: ${{ matrix.arch }}
ZIP_PKG_NAME: WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}.zip
DERIVED_DATA_PATH: wda_build
WD: wda_build/Build/Products/${{ matrix.sim_dir }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}
path: WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}.zip
if-no-files-found: error
publish:
name: Publish to Cloudflare R2
needs: [build-real, build-sim]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Generate SHA256SUMS and BUILD_INFO
working-directory: dist
run: |
set -eu
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
else
VERSION="preview-${GITHUB_SHA::7}"
fi
sha256sum *.zip > SHA256SUMS
{
echo "version=${VERSION}"
echo "commit=${GITHUB_SHA}"
echo "ref=${GITHUB_REF}"
echo "event=${{ github.event_name }}"
echo "built_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
} > BUILD_INFO.txt
echo "----- dist/ -----"; ls -la
echo "----- SHA256SUMS -----"; cat SHA256SUMS
echo "----- BUILD_INFO.txt -----"; cat BUILD_INFO.txt
# --- Release: versioned folder + latest mirror ---
- name: Upload to R2 (versioned)
if: github.event_name == 'release'
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ vars.R2_BUCKET }}
source-dir: dist
destination-dir: releases/mobilerun-wda/${{ github.event.release.tag_name }}
- name: Upload to R2 (latest)
if: github.event_name == 'release'
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ vars.R2_BUCKET }}
source-dir: dist
destination-dir: releases/mobilerun-wda/latest
- name: Attach artifacts to GitHub Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: dist/*
# --- Trunk: preview folder (only from master) ---
- name: Upload to R2 (preview)
if: ${{ github.event_name != 'release' && github.ref == 'refs/heads/master' }}
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ vars.R2_BUCKET }}
source-dir: dist
destination-dir: releases/mobilerun-wda/preview