From e86d25e0fe72c98b900a7ca2cf31f7436c3a0366 Mon Sep 17 00:00:00 2001 From: Pavel Holec Date: Tue, 12 Nov 2024 10:59:04 +0100 Subject: [PATCH] scr --- .github/workflows/ci.yml | 22 ++++++++++++--- .github/workflows/regenerate_snapshots.yml | 30 -------------------- Automation/regenerate_snapshots.sh | 33 ---------------------- 3 files changed, 18 insertions(+), 67 deletions(-) delete mode 100644 .github/workflows/regenerate_snapshots.yml delete mode 100755 Automation/regenerate_snapshots.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 253c1f57769..d6bc0362373 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,21 @@ jobs: regenerate_snapshots: if: ${{ failure() }} needs: test - uses: ./.github/workflows/regenerate_snapshots.yml - secrets: - SNAPSHOT_PUSH_TOKEN: ${{ secrets.SNAPSHOT_PUSH_TOKEN }} - REF: ${{ github.event.pull_request.head.ref }} \ No newline at end of file + strategy: + matrix: + device: ["iPhone SE (3rd generation)"] + os_version: ["17.0"] + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.SNAPSHOT_PUSH_TOKEN }} + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + - name: Regenerate Snapshots + run: | + id=$(Automation/get_simulator.py "${{ matrix.device }}" "${{ matrix.os_version }}") + set -o pipefail && xcodebuild test -scheme Orbit-Package -destination "platform=iOS Simulator,id=$id,OS=${{ matrix.os_version }}" OTHER_SWIFT_FLAGS="-D XCODE_IS_SNAPSHOTS_RECORDING" | xcpretty + git -C Snapshots/ add . + git commit -m "Snapshots - ${{ matrix.device }} ${{ matrix.os_version }}" || true + git push diff --git a/.github/workflows/regenerate_snapshots.yml b/.github/workflows/regenerate_snapshots.yml deleted file mode 100644 index 72f4c370c9b..00000000000 --- a/.github/workflows/regenerate_snapshots.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Regenerate Snapshots - -on: - workflow_dispatch: - workflow_call: - secrets: - SNAPSHOT_PUSH_TOKEN: - required: true - REF: - required: true - -env: - DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer - -jobs: - generate_snapshots: - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.SNAPSHOT_PUSH_TOKEN }} - fetch-depth: 0 - ref: ${{ secrets.REF }} - - name: generate - run: | - Automation/regenerate_snapshots.sh - - name: upload - run: | - git config --global user.name "Mobile Automation" - git config --global user.email "mobile.automation@kiwi.com" diff --git a/Automation/regenerate_snapshots.sh b/Automation/regenerate_snapshots.sh deleted file mode 100755 index d0b336bdded..00000000000 --- a/Automation/regenerate_snapshots.sh +++ /dev/null @@ -1,33 +0,0 @@ - #!/bin/bash - -set -eou pipefail - -SCHEME="Orbit-Package" -IOS_VERSION="17.0" - -SIMULATORS=( - "iPhone SE (3rd generation)" -) - -echo "Verifying iOS $IOS_VERSION runtime is available..." -xcrun simctl list runtimes | grep -q "iOS $IOS_VERSION" - -for (( i=0; i<${#SIMULATORS[@]}; i+=1 )); do - SIMULATOR_NAME=${SIMULATORS[i]} - - echo "Setting up simulator $SIMULATOR_NAME ($IOS_VERSION) ..." - - SIMCTL_RUNTIME_VERSION=$(echo "$IOS_VERSION" | tr "." "-") - RUNTIME="com.apple.CoreSimulator.SimRuntime.iOS-$SIMCTL_RUNTIME_VERSION" - SIMULATOR_ID=$(xcrun simctl create "$SIMULATOR_NAME" "$SIMULATOR_NAME" "$RUNTIME") - - echo "Generating snapshots for $SIMULATOR_NAME ($IOS_VERSION) ..." - - xcodebuild test -quiet -scheme $SCHEME -destination "platform=iOS Simulator,id=$SIMULATOR_ID,OS=$IOS_VERSION" OTHER_SWIFT_FLAGS="-D XCODE_IS_SNAPSHOTS_RECORDING" - - git -C Snapshots/ add . - git commit -m "Snapshots - $SIMULATOR_NAME" || true -done - -echo "Pushing any snapshot commits..." -git push