Skip to content

Commit

Permalink
chore: refactor ci (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Jul 23, 2024
1 parent 4a2093d commit 9f15d2d
Show file tree
Hide file tree
Showing 24 changed files with 169 additions and 171 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- macOS
- macOS,variant=Mac Catalyst
- iOS Simulator,name=iPhone 15 Pro
- tvOS Simulator,name=Apple TV
- watchOS Simulator,name=Apple Watch Series 9 (41mm)
- visionOS Simulator,name=Any visionOS Simulator Device
config:
- debug
- release
runs-on: macos-14
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" SCHEME=Auth make test-library
run: CONFIG="${{ matrix.config }}" make test-auth

test-linux:
name: Test Auth (Linux)
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- macOS
- macOS,variant=Mac Catalyst
- iOS Simulator,name=iPhone 15 Pro
- tvOS Simulator,name=Apple TV
- watchOS Simulator,name=Apple Watch Series 9 (41mm)
- visionOS Simulator,name=Any visionOS Simulator Device
config:
- debug
- release
runs-on: macos-14
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" SCHEME=Functions make test-library
run: CONFIG="${{ matrix.config }}" make test-functions
test-linux:
name: Test Functions (Linux)
strategy:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: make test-integration
env:
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- macOS
- macOS,variant=Mac Catalyst
- iOS Simulator,name=iPhone 15 Pro
- tvOS Simulator,name=Apple TV
- watchOS Simulator,name=Apple Watch Series 9 (41mm)
- visionOS Simulator,name=Any visionOS Simulator Device
config:
- debug
- release
runs-on: macos-14
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" SCHEME=PostgREST make test-library
run: CONFIG="${{ matrix.config }}" make test-postgrest
test-linux:
name: Test Postgrest (Linux)
strategy:
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/realtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- macOS
- macOS,variant=Mac Catalyst
- iOS Simulator,name=iPhone 15 Pro
- tvOS Simulator,name=Apple TV
- watchOS Simulator,name=Apple Watch Series 9 (41mm)
- visionOS Simulator,name=Any visionOS Simulator Device
config:
- debug
- release
runs-on: macos-14
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" SCHEME=Realtime make test-library
run: CONFIG="${{ matrix.config }}" make test-realtime
test-linux:
name: Test Realtime (Linux)
strategy:
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- macOS
- macOS,variant=Mac Catalyst
- iOS Simulator,name=iPhone 15 Pro
- tvOS Simulator,name=Apple TV
- watchOS Simulator,name=Apple Watch Series 9 (41mm)
- visionOS Simulator,name=Any visionOS Simulator Device
config:
- debug
- release
runs-on: macos-14
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" SCHEME=Storage make test-library
run: CONFIG="${{ matrix.config }}" make test-storage
test-linux:
name: Test Storage (Linux)
strategy:
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/supabase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- macOS
- macOS,variant=Mac Catalyst
- iOS Simulator,name=iPhone 15 Pro
- tvOS Simulator,name=Apple TV
- watchOS Simulator,name=Apple Watch Series 9 (41mm)
- visionOS Simulator,name=Any visionOS Simulator Device
config:
- debug
- release
runs-on: macos-14
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: PLATFORM="${{ matrix.platform }}" SCHEME=Supabase make test-library
run: CONFIG="${{ matrix.config }}" make test-library
test-linux:
name: Test Supabase (Linux)
strategy:
Expand Down
7 changes: 2 additions & 5 deletions .swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:TestPlans/AllTests.xctestplan"
reference = "container:TestPlans/Supabase.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:TestPlans/IntegrationTests.xctestplan">
</TestPlanReference>
<TestPlanReference
reference = "container:TestPlans/Supabase.xctestplan">
reference = "container:TestPlans/Integration.xctestplan">
</TestPlanReference>
</TestPlans>
</TestAction>
Expand Down
69 changes: 47 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
PLATFORM_IOS = iOS Simulator,name=iPhone 15 Pro
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.5,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,name=Apple TV
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 9 (41mm)
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17.5,TV)
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS 1.2,Vision)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10.5,Watch)

SCHEME ?= Supabase
PLATFORM ?= iOS Simulator,name=iPhone 15 Pro
PLATFORM ?= $(PLATFORM_IOS)

export SECRETS
define SECRETS
Expand All @@ -22,31 +24,50 @@ load-env:
dot-env:
@echo "$$SECRETS" > Tests/IntegrationTests/DotEnv.swift

test-all: dot-env
set -o pipefail && \
xcodebuild test \
-skipMacroValidation \
-workspace supabase-swift.xcworkspace \
-scheme "$(SCHEME)" \
-testPlan AllTests \
-destination platform="$(PLATFORM)" | xcpretty

build-all-platforms:
for platform in "iOS" "macOS" "macOS,variant=Mac Catalyst" "tvOS" "visionOS" "watchOS"; do \
xcodebuild \
-skipMacroValidation \
-configuration "$(CONFIG)" \
-workspace Supabase.xcworkspace \
-scheme "$(SCHEME)" \
-testPlan AllTests \
-destination platform="$$platform" | xcpretty || exit 1; \
done

test-library: dot-env
set -o pipefail && \
xcodebuild test \
-skipMacroValidation \
-workspace supabase-swift.xcworkspace \
-scheme "$(SCHEME)" \
-derivedDataPath /tmp/derived-data \
-destination platform="$(PLATFORM)" | xcpretty
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_VISIONOS)" "$(PLATFORM_WATCHOS)"; do \
xcodebuild test \
-skipMacroValidation \
-configuration "$(CONFIG)" \
-workspace Supabase.xcworkspace \
-scheme "$(SCHEME)" \
-destination platform="$$platform" | xcpretty || exit 1; \
done

test-auth:
$(MAKE) SCHEME=Auth test-library

test-functions:
$(MAKE) SCHEME=Functions test-library

test-postgrest:
$(MAKE) SCHEME=PostgREST test-library

test-realtime:
$(MAKE) SCHEME=Realtime test-library

test-storage:
$(MAKE) SCHEME=Storage test-library

test-integration: dot-env
set -o pipefail && \
xcodebuild test \
-skipMacroValidation \
-workspace supabase-swift.xcworkspace \
-workspace Supabase.xcworkspace \
-scheme Supabase \
-testPlan IntegrationTests \
-testPlan Integration \
-destination platform="$(PLATFORM_IOS)" | xcpretty


Expand Down Expand Up @@ -80,7 +101,7 @@ build-examples:
set -o pipefail && \
xcodebuild build \
-skipMacroValidation \
-workspace supabase-swift.xcworkspace \
-workspace Supabase.xcworkspace \
-scheme "$$scheme" \
-destination platform="$(PLATFORM_IOS)" | xcpretty; \
done
Expand All @@ -89,3 +110,7 @@ format:
@swiftformat .

.PHONY: test-library test-linux build-example format

define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef
26 changes: 13 additions & 13 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "f01efb26f3a192a0e88dcdb7c3c391ec2fc25d9c",
"version" : "1.3.0"
"revision" : "d237304f42af07f22563aa4cc2d7e2cfb25da82e",
"version" : "1.3.1"
}
},
{
"identity" : "swift-issue-reporting",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-issue-reporting",
"state" : {
"revision" : "c85092304cda8cb38d2d68454b29609a8013620b",
"version" : "1.2.1"
}
},
{
Expand All @@ -41,17 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
"version" : "510.0.2"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "6f30bdba373bbd7fbfe241dddd732651f2fbd1e2",
"version" : "1.1.2"
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
}
],
Expand Down
Loading

0 comments on commit 9f15d2d

Please sign in to comment.