Skip to content

Commit be82ac2

Browse files
committed
ci: refactor ci
1 parent b159fb9 commit be82ac2

File tree

4 files changed

+206
-8
lines changed

4 files changed

+206
-8
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
xcodebuild:
18+
name: xcodebuild
19+
runs-on: macos-14
20+
strategy:
21+
matrix:
22+
command: [test, '']
23+
platform: [iOS, macOS, tvOS, watchOS, visionOS, macCatalyst]
24+
xcode: [15.4, '16.0']
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Select Xcode ${{ matrix.xcode }}
28+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
29+
- name: Cache derived data
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
~/.derivedData
34+
key: |
35+
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
36+
restore-keys: |
37+
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
38+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
39+
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
40+
- name: Update mtime for incremental builds
41+
uses: chetan/git-restore-mtime-action@v2
42+
- name: Debug
43+
run: make COMMAND="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
44+
- name: Release
45+
if: matrix.skip_release != '1'
46+
run: make COMMAND="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild
47+
48+
library-evolution:
49+
name: Library (evolution)
50+
runs-on: macos-14
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Select Xcode 15.4
54+
run: sudo xcode-select -s /Applications/Xcode_15.4.app
55+
- name: Build for library evolution
56+
run: make build-for-library-evolution
57+
58+
# examples:
59+
# name: Examples
60+
# runs-on: macos-14
61+
# steps:
62+
# - uses: actions/checkout@v4
63+
# - name: Cache derived data
64+
# uses: actions/cache@v3
65+
# with:
66+
# path: ~/.derivedData
67+
# key: |
68+
# deriveddata-examples-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Examples/**/*.swift') }}
69+
# restore-keys: |
70+
# deriveddata-examples-
71+
# - name: Select Xcode 16
72+
# run: sudo xcode-select -s /Applications/Xcode_16.0.app
73+
# - name: Set IgnoreFileSystemDeviceInodeChanges flag
74+
# run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
75+
# - name: Update mtime for incremental builds
76+
# uses: chetan/git-restore-mtime-action@v2
77+
# - name: CaseStudies (SwiftUI)
78+
# run: make SCHEME="CaseStudies (SwiftUI)" test-example
79+
# - name: CaseStudies (UIKit)
80+
# run: make SCHEME="CaseStudies (UIKit)" test-example
81+
# - name: Search
82+
# run: make SCHEME="Search" test-example
83+
# - name: SyncUps
84+
# run: make SCHEME="SyncUps" test-example
85+
# - name: SpeechRecognition
86+
# run: make SCHEME="SpeechRecognition" test-example
87+
# - name: TicTacToe
88+
# run: make SCHEME="TicTacToe" test-example
89+
# - name: Todos
90+
# run: make SCHEME="Todos" test-example
91+
# - name: VoiceMemos
92+
# run: make SCHEME="VoiceMemos" test-example

Makefile

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
CONFIG = debug
2-
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.5,iPhone \d\+ Pro [^M])
2+
PLATFORM = iOS
3+
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS,iPhone \d\+ Pro [^M])
34
PLATFORM_MACOS = macOS
45
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
5-
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17.5,TV)
6-
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS 1.2,Vision)
7-
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10.5,Watch)
8-
9-
SCHEME ?= Supabase
10-
PLATFORM ?= $(PLATFORM_IOS)
6+
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS,TV)
7+
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS,Vision)
8+
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS,Watch)
119

1210
export SECRETS
1311
define SECRETS
@@ -18,6 +16,64 @@ enum DotEnv {
1816
}
1917
endef
2018

19+
default: test-all
20+
21+
test-all:
22+
$(MAKE) CONFIG=debug test-library
23+
$(MAKE) CONFIG=release test-library
24+
25+
xcodebuild:
26+
if test "$(PLATFORM)" = "iOS"; \
27+
then xcodebuild $(COMMAND) \
28+
-skipMacroValidation \
29+
-configuration $(CONFIG) \
30+
-workspace Supabase.xcworkspace \
31+
-scheme Supabase \
32+
-destination platform="$(PLATFORM_IOS)" \
33+
-derivedDataPath ~/.derivedData/$(CONFIG) | xcpretty; \
34+
elif test "$(PLATFORM)" = "macOS"; \
35+
then xcodebuild $(COMMAND) \
36+
-skipMacroValidation \
37+
-configuration $(CONFIG) \
38+
-workspace Supabase.xcworkspace \
39+
-scheme Supabase \
40+
-destination platform="$(PLATFORM_MACOS)" \
41+
-derivedDataPath ~/.derivedData/$(CONFIG) | xcpretty; \
42+
elif test "$(PLATFORM)" = "tvOS"; \
43+
then xcodebuild $(COMMAND) \
44+
-skipMacroValidation \
45+
-configuration $(CONFIG) \
46+
-workspace Supabase.xcworkspace \
47+
-scheme Supabase \
48+
-destination platform="$(PLATFORM_TVOS)" \
49+
-derivedDataPath ~/.derivedData/$(CONFIG) | xcpretty; \
50+
elif test "$(PLATFORM)" = "watchOS"; \
51+
then xcodebuild $(COMMAND) \
52+
-skipMacroValidation \
53+
-configuration $(CONFIG) \
54+
-workspace Supabase.xcworkspace \
55+
-scheme Supabase \
56+
-destination platform="$(PLATFORM_WATCHOS)" \
57+
-derivedDataPath ~/.derivedData/$(CONFIG) | xcpretty; \
58+
elif test "$(PLATFORM)" = "visionOS"; \
59+
then xcodebuild $(COMMAND) \
60+
-skipMacroValidation \
61+
-configuration $(CONFIG) \
62+
-workspace Supabase.xcworkspace \
63+
-scheme Supabase \
64+
-destination platform="$(PLATFORM_VISIONOS)" \
65+
-derivedDataPath ~/.derivedData/$(CONFIG) | xcpretty; \
66+
elif test "$(PLATFORM)" = "macCatalyst"; \
67+
then xcodebuild $(COMMAND) \
68+
-skipMacroValidation \
69+
-configuration $(CONFIG) \
70+
-workspace Supabase.xcworkspace \
71+
-scheme Supabase \
72+
-destination platform="$(PLATFORM_MAC_CATALYST)" \
73+
-derivedDataPath ~/.derivedData/$(CONFIG) | xcpretty; \
74+
else exit 1; \
75+
fi;
76+
2177
load-env:
2278
@. ./scripts/load_env.sh
2379

@@ -82,7 +138,6 @@ build-for-library-evolution:
82138
-Xswiftc -emit-module-interface \
83139
-Xswiftc -enable-library-evolution
84140

85-
86141
DOC_WARNINGS = $(shell xcodebuild clean docbuild \
87142
-scheme Supabase \
88143
-destination platform="$(PLATFORM_MACOS)" \

Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TestPlans/Supabase.xctestplan

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,54 @@
1212

1313
},
1414
"testTargets" : [
15+
{
16+
"target" : {
17+
"containerPath" : "container:",
18+
"identifier" : "AuthTests",
19+
"name" : "AuthTests"
20+
}
21+
},
22+
{
23+
"target" : {
24+
"containerPath" : "container:",
25+
"identifier" : "HelpersTests",
26+
"name" : "HelpersTests"
27+
}
28+
},
1529
{
1630
"target" : {
1731
"containerPath" : "container:",
1832
"identifier" : "SupabaseTests",
1933
"name" : "SupabaseTests"
2034
}
35+
},
36+
{
37+
"target" : {
38+
"containerPath" : "container:",
39+
"identifier" : "StorageTests",
40+
"name" : "StorageTests"
41+
}
42+
},
43+
{
44+
"target" : {
45+
"containerPath" : "container:",
46+
"identifier" : "PostgRESTTests",
47+
"name" : "PostgRESTTests"
48+
}
49+
},
50+
{
51+
"target" : {
52+
"containerPath" : "container:",
53+
"identifier" : "FunctionsTests",
54+
"name" : "FunctionsTests"
55+
}
56+
},
57+
{
58+
"target" : {
59+
"containerPath" : "container:",
60+
"identifier" : "RealtimeTests",
61+
"name" : "RealtimeTests"
62+
}
2163
}
2264
],
2365
"version" : 1

0 commit comments

Comments
 (0)