From 65ddb2d2ca3b316fe8d06d4ee6cb30d2fceea7dc Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Wed, 18 Oct 2023 05:19:30 -0300 Subject: [PATCH] CI --- .github/workflows/ci.yml | 21 ++++++--------------- Makefile | 24 ++++++++++++++++++------ 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0452d81a..8fb78277 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,8 @@ on: - main pull_request: branches: - - "*" + - '*' + workflow_dispatch: concurrency: group: ci-${{ github.ref }} @@ -15,27 +16,17 @@ concurrency: jobs: library: runs-on: macos-13 - strategy: - matrix: - platform: - - iOS Simulator,name=iPhone 14 Pro Max - - macOS - - tvOS Simulator,name=Apple TV - - watchOS Simulator,name=Apple Watch Series 7 (45mm) - + name: Test Library steps: - uses: actions/checkout@v3 - name: Select Xcode 14.3 run: sudo xcode-select -s /Applications/Xcode_14.3.app - name: Run tests - run: PLATFORM="${{ matrix.platform }}" make test-library + run: make test-library example: runs-on: macos-13 - strategy: - matrix: - platform: - - iOS Simulator,name=iPhone 14 Pro Max + name: Build Example steps: - uses: actions/checkout@v3 - name: Select Xcode 14.3 @@ -43,4 +34,4 @@ jobs: - name: Copy Secrets file run: cp Examples/Examples/_Secrets.swift Examples/Examples/Secrets.swift - name: Build example - run: PLATFORM="${{ matrix.platform }}" make build-example \ No newline at end of file + run: make build-example \ No newline at end of file diff --git a/Makefile b/Makefile index b9b418dc..ca06e3bc 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,28 @@ -PLATFORM = iOS Simulator,name=iPhone 15 Pro Max +PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iPhone,iOS-16) +PLATFORM_MACOS = macOS +PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst +PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,TV,tvOS-16) +PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,Watch,watchOS-9) test-library: - xcodebuild test \ - -workspace supabase-swift.xcworkspace \ - -scheme Supabase-Package \ - -destination platform="$(PLATFORM)" || exit 1; + for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_WATCHOS)"; do \ + xcodebuild test \ + -workspace supabase-swift.xcworkspace \ + -scheme Supabase-Package \ + -destination platform="$$platform" || exit 1; \ + done; build-example: xcodebuild build \ -workspace supabase-swift.xcworkspace \ -scheme Examples \ - -destination platform="$(PLATFORM)" || exit 1; + -destination platform="$$platform" || exit 1; format: @swift format -i -r . + +.PHONY: test-library build-example format + +define udid_for +$(shell xcrun simctl list --json devices available $(1) | jq -r '.devices | to_entries | map(select(.value | add)) | sort_by(.key) | .[] | select(.key | contains("$(2)")) | .value | last.udid') +endef \ No newline at end of file