diff --git a/.github/workflows/prebuild-r2.yml b/.github/workflows/prebuild-r2.yml new file mode 100644 index 000000000..67f040cc9 --- /dev/null +++ b/.github/workflows/prebuild-r2.yml @@ -0,0 +1,205 @@ +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// + 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 }}" + # The iOS runner links HevSocks5Tunnel.xcframework via the + # WebDriverAgentTunnel appex; build it from the submodule first + # (idempotent/stamped). tvOS does not link the tunnel. + - name: Build SOCKS5 tunnel xcframework + if: ${{ matrix.ios }} + run: bash "$GITHUB_WORKSPACE/Scripts/build-hev-socks5-tunnel.sh" + - 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 SOCKS5 tunnel xcframework + if: ${{ matrix.ios }} + run: bash "$GITHUB_WORKSPACE/Scripts/build-hev-socks5-tunnel.sh" + - 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 diff --git a/.github/workflows/wda-package.yml b/.github/workflows/wda-package.yml deleted file mode 100644 index c841cec86..000000000 --- a/.github/workflows/wda-package.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Building WebDriverAgent - -on: - workflow_dispatch: - -env: - HOST: macos-15 - 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: - host_machine: - runs-on: ubuntu-latest - outputs: - host: ${{ steps.macos_host.outputs.host }} - steps: - - run: | - echo "host=${{ env.HOST }}" >> $GITHUB_OUTPUT - id: macos_host - - for_real_devices: - needs: [host_machine] - name: Build WDA for real iOS and tvOS devices - runs-on: ${{ needs.host_machine.outputs.host }} - - env: - PKG_NAME_IOS: "WebDriverAgentRunner-Runner" - ZIP_PKG_NAME_IOS: "WebDriverAgentRunner-Runner.zip" - PKG_NAME_TVOS: "WebDriverAgentRunner_tvOS-Runner" - ZIP_PKG_NAME_TVOS: "WebDriverAgentRunner_tvOS-Runner.zip" - - steps: - - name: Checkout - uses: actions/checkout@v6 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: "${{ env.XCODE_VERSION }}" - - name: Create a zip file of WebDriverAgentRunner-Runner.app for iOS - run: sh $GITHUB_WORKSPACE/Scripts/ci/build-real.sh - env: - DERIVED_DATA_PATH: appium_wda_ios - SCHEME: WebDriverAgentRunner - DESTINATION: generic/platform=iOS - WD: appium_wda_ios/Build/Products/Debug-iphoneos - ZIP_PKG_NAME: "${{ env.ZIP_PKG_NAME_IOS }}" - - - name: Create a zip file of WebDriverAgentRunner-Runner.app for tvOS - run: sh $GITHUB_WORKSPACE/Scripts/ci/build-real.sh - env: - DERIVED_DATA_PATH: appium_wda_tvos - SCHEME: WebDriverAgentRunner_tvOS - DESTINATION: generic/platform=tvOS - WD: appium_wda_tvos/Build/Products/Debug-appletvos - ZIP_PKG_NAME: "${{ env.ZIP_PKG_NAME_TVOS }}" - - - name: Upload the built generic app package for iOS - uses: actions/upload-artifact@master - with: - name: "${{ env.PKG_NAME_IOS }}" - path: "${{ env.ZIP_PKG_NAME_IOS }}" - - name: Upload the built generic app package for tvOS - uses: actions/upload-artifact@master - with: - name: "${{ env.PKG_NAME_TVOS }}" - path: "${{ env.ZIP_PKG_NAME_TVOS }}" - - for_simulator_devices: - needs: [host_machine] - name: Build WDA for ${{ matrix.target }} simulators - runs-on: ${{ needs.host_machine.outputs.host }} - - strategy: - matrix: - include: - - target: '' - arch: x86_64 - simulator_name: Debug-iphonesimulator - - target: '' - arch: arm64 - simulator_name: Debug-iphonesimulator - - target: '_tvOS' - arch: x86_64 - simulator_name: Debug-appletvsimulator - - target: '_tvOS' - arch: arm64 - simulator_name: Debug-appletvsimulator - steps: - - name: Checkout - uses: actions/checkout@v6 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: "${{ env.XCODE_VERSION }}" - - name: Create a zip of WebDriverAgentRunner${{ matrix.target }} for simulator for ${{ matrix.arch }} - 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.simulator_name }} - - name: Upload the built generic app package for WebDriverAgentRunner${{ matrix.target }} with ${{ matrix.arch }} - uses: actions/upload-artifact@master - with: - name: "WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}" - path: "WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}.zip"