Skip to content

Commit 36d0fc0

Browse files
authored
ci: refactor ci (#545)
* ci: refactor ci * disable workflows * remove library-evolution job * add build examples job * fix * wip * add linux job * cache linux builds * fix * fix * fix cache build path
1 parent 3a44f30 commit 36d0fc0

File tree

13 files changed

+224
-48
lines changed

13 files changed

+224
-48
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
linux:
49+
name: linux
50+
strategy:
51+
matrix:
52+
swift-version: ["5.10"]
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: swift-actions/setup-swift@v2
57+
with:
58+
swift-version: ${{ matrix.swift-version }}
59+
- name: Cache build
60+
uses: actions/cache@v3
61+
with:
62+
path: |
63+
.build
64+
key: |
65+
build-spm-linux-${{ matrix.swift-verion }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Package.resolved') }}
66+
restore-keys: |
67+
build-spm-linux-${{ matrix.swift-verion }}-
68+
- run: make dot-env
69+
- name: Run tests
70+
run: swift test --skip IntegrationTests
71+
72+
73+
# library-evolution:
74+
# name: Library (evolution)
75+
# runs-on: macos-14
76+
# steps:
77+
# - uses: actions/checkout@v4
78+
# - name: Select Xcode 15.4
79+
# run: sudo xcode-select -s /Applications/Xcode_15.4.app
80+
# - name: Build for library evolution
81+
# run: make build-for-library-evolution
82+
83+
examples:
84+
name: Examples
85+
runs-on: macos-14
86+
steps:
87+
- uses: actions/checkout@v4
88+
- name: Cache derived data
89+
uses: actions/cache@v3
90+
with:
91+
path: ~/.derivedData
92+
key: |
93+
deriveddata-examples-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Examples/**/*.swift') }}
94+
restore-keys: |
95+
deriveddata-examples-
96+
- name: Select Xcode 16
97+
run: sudo xcode-select -s /Applications/Xcode_16.app
98+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
99+
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
100+
- name: Update mtime for incremental builds
101+
uses: chetan/git-restore-mtime-action@v2
102+
- name: Examples
103+
run: make SCHEME="Examples" build-example
104+
- name: SlackClone
105+
run: make SCHEME="SlackClone" build-example
106+
- name: UserManagement
107+
run: make SCHEME="UserManagement" build-example
108+
File renamed without changes.

Makefile

Lines changed: 70 additions & 27 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

@@ -36,16 +92,6 @@ build-all-platforms:
3692
-destination platform="$$platform" | xcpretty || exit 1; \
3793
done
3894

39-
test-library: dot-env
40-
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_VISIONOS)" "$(PLATFORM_WATCHOS)"; do \
41-
xcodebuild test \
42-
-skipMacroValidation \
43-
-configuration "$(CONFIG)" \
44-
-workspace Supabase.xcworkspace \
45-
-scheme "$(SCHEME)" \
46-
-destination platform="$$platform" | xcpretty || exit 1; \
47-
done
48-
4995
test-auth:
5096
$(MAKE) SCHEME=Auth test-library
5197

@@ -82,7 +128,6 @@ build-for-library-evolution:
82128
-Xswiftc -emit-module-interface \
83129
-Xswiftc -enable-library-evolution
84130

85-
86131
DOC_WARNINGS = $(shell xcodebuild clean docbuild \
87132
-scheme Supabase \
88133
-destination platform="$(PLATFORM_MACOS)" \
@@ -96,15 +141,13 @@ test-docs:
96141
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
97142
&& exit 1)
98143

99-
build-examples:
100-
for scheme in Examples UserManagement SlackClone; do \
101-
set -o pipefail && \
102-
xcodebuild build \
103-
-skipMacroValidation \
104-
-workspace Supabase.xcworkspace \
105-
-scheme "$$scheme" \
106-
-destination platform="$(PLATFORM_IOS)" | xcpretty; \
107-
done
144+
build-example:
145+
xcodebuild build \
146+
-skipMacroValidation \
147+
-workspace Supabase.xcworkspace \
148+
-scheme "$(SCHEME)" \
149+
-destination platform="$(PLATFORM_IOS)" \
150+
-derivedDataPath ~/.derivedData | xcpretty;
108151

109152
format:
110153
@swiftformat .

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

Tests/AuthTests/SessionManagerTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ final class SessionManagerTests: XCTestCase {
3232
configuration: .init(
3333
url: clientURL,
3434
localStorage: InMemoryLocalStorage(),
35-
logger: TestLogger(),
3635
autoRefreshToken: false
3736
),
3837
http: http,
@@ -112,9 +111,3 @@ final class SessionManagerTests: XCTestCase {
112111
}
113112
}
114113
}
115-
116-
struct TestLogger: SupabaseLogger {
117-
func log(message: SupabaseLogMessage) {
118-
print(message.description)
119-
}
120-
}

0 commit comments

Comments
 (0)