From b705fdc03a6187693197791a60d3a75507e74cf3 Mon Sep 17 00:00:00 2001 From: Ioannis J Date: Fri, 1 Nov 2024 15:48:24 +0200 Subject: [PATCH] ci(test): revert iOS tests runs are failing on CI both for make test and make test-ios. Will address in another PR --- .github/workflows/test.yml | 38 ++++++++++++++++++-------------------- Makefile | 21 ++++++++++++++------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1658a5bc9..5553bc90a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,20 +1,18 @@ -name: Tests -on: - push: - branches: - - main - pull_request: - paths-ignore: - - "**/*.md" -jobs: - test: - runs-on: macos-13 - steps: - - uses: actions/checkout@v4 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - name: Test SDK - run: make test - - name: Test SDK (iOS) - run: make test-ios + name: Tests + on: + push: + branches: + - main + pull_request: + paths-ignore: + - "**/*.md" + jobs: + test: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + - name: Test SDK + run: make test diff --git a/Makefile b/Makefile index 501bb90de..387a38dc0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -SIMULATOR_IOS_VERSION= $(shell xcrun simctl list | grep ^iOS | ruby -e 'puts /\(([0-9.]+).*\)/.match(STDIN.read.chomp.split("\n").last).to_a[1]') -SIMULATOR_ID = $(call simulator_uuid_for,$(SIMULATOR_IOS_VERSION),iPhone \d\+) # skip Pro Max +SIMULATOR_IOS_VERSION = $(shell xcrun simctl list | grep ^iOS | ruby -e 'puts /\(([0-9.]+).*\)/.match(STDIN.read.chomp.split("\n").last).to_a[1]') +SIMULATOR_ID = $(call udid_for,$(SIMULATOR_IOS_VERSION),iPhone [0-9]+ [^M]) TEST_ITERATIONS = 1 .PHONY: build buildSdk buildExamples format swiftLint swiftFormat test testOniOSSimulator testOnMacSimulator lint bootstrap releaseCocoaPods @@ -30,8 +30,8 @@ buildExamples: format: swiftLint swiftFormat print-env: - @echo "Simulator iOS version: $(SIMULATOR_IOS_VERSION)" - @echo "Simulator UUID: $(SIMULATOR_ID)" + @echo "Simulator iOS version: '$(SIMULATOR_IOS_VERSION)'" + @echo "Simulator UUID: '$(SIMULATOR_ID)'" swiftLint: swiftlint --fix @@ -61,6 +61,13 @@ releaseCocoaPods: pod trunk push PostHog.podspec --allow-warnings -define simulator_uuid_for -$(shell xcrun simctl list devices available 'iOS $(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{print $$(NF-3)}') -endef \ No newline at end of file +define udid_for +$(shell xcrun simctl list --json devices available "$(1)" | jq -r --arg regex "$(2)" ' + .devices + | to_entries + | map(select(.value | length > 0)) + | map({key: .key, value: (.value | map(select(.name | test($$regex))))}) + | map(select(.value | length > 0)) + | .[0].value[0].udid +') +endef