Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Oct 18, 2023
1 parent 1c633de commit 37dab1e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
- main
pull_request:
branches:
- "*"
- '*'
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
Expand All @@ -15,32 +16,22 @@ 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
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Copy Secrets file
run: cp Examples/Examples/_Secrets.swift Examples/Examples/Secrets.swift
- name: Build example
run: PLATFORM="${{ matrix.platform }}" make build-example
run: make build-example
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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_IOS)" || 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

0 comments on commit 37dab1e

Please sign in to comment.