Skip to content

Commit 47819e0

Browse files
committed
ci
1 parent 70158cc commit 47819e0

File tree

2 files changed

+38
-110
lines changed

2 files changed

+38
-110
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ jobs:
100100
- name: Update mtime for incremental builds
101101
uses: chetan/git-restore-mtime-action@v2
102102
- name: Examples
103-
run: make SCHEME="Examples" build-example
103+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="Examples" XCODEBUILD_ARGUMENT=build xcodebuild
104104
- name: SlackClone
105-
run: make SCHEME="SlackClone" build-example
105+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="SlackClone" XCODEBUILD_ARGUMENT=build xcodebuild
106106
- name: UserManagement
107-
run: make SCHEME="UserManagement" build-example
107+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="UserManagement" XCODEBUILD_ARGUMENT=build xcodebuild
108108

Makefile

Lines changed: 35 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,42 @@
1-
CONFIG = debug
2-
PLATFORM = iOS
1+
CONFIG = Debug
2+
3+
DERIVED_DATA_PATH = ~/.derivedData/$(CONFIG)
4+
35
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS,iPhone \d\+ Pro [^M])
46
PLATFORM_MACOS = macOS
57
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
68
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS,TV)
79
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS,Vision)
810
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS,Watch)
911

12+
13+
PLATFORM = IOS
14+
DESTINATION = platform="$(PLATFORM_$(PLATFORM))"
15+
16+
SCHEME = Supabase
17+
18+
WORKSPACE = Supabase.xcworkspace
19+
20+
XCODEBUILD_ARGUMENT = test
21+
22+
XCODEBUILD_FLAGS = \
23+
-configuration $(CONFIG) \
24+
-derivedDataPath $(DERIVED_DATA_PATH) \
25+
-destination $(DESTINATION) \
26+
-scheme "$(SCHEME)" \
27+
-skipMacroValidation \
28+
-workspace $(WORKSPACE)
29+
30+
XCODEBUILD_COMMAND = xcodebuild $(XCODEBUILD_ARGUMENT) $(XCODEBUILD_FLAGS)
31+
32+
ifneq ($(strip $(shell which xcbeautify)),)
33+
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify --quiet
34+
else
35+
XCODEBUILD = $(XCODEBUILD_COMMAND)
36+
endif
37+
38+
TEST_RUNNER_CI = $(CI)
39+
1040
export SECRETS
1141
define SECRETS
1242
enum DotEnv {
@@ -16,110 +46,17 @@ enum DotEnv {
1646
}
1747
endef
1848

19-
default: test-all
20-
21-
test-all:
22-
$(MAKE) CONFIG=debug test-library
23-
$(MAKE) CONFIG=release test-library
24-
2549
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;
50+
$(XCODEBUILD)
7651

7752
load-env:
7853
@. ./scripts/load_env.sh
7954

8055
dot-env:
8156
@echo "$$SECRETS" > Tests/IntegrationTests/DotEnv.swift
8257

83-
84-
build-all-platforms:
85-
for platform in "iOS" "macOS" "macOS,variant=Mac Catalyst" "tvOS" "visionOS" "watchOS"; do \
86-
xcodebuild \
87-
-skipMacroValidation \
88-
-configuration "$(CONFIG)" \
89-
-workspace Supabase.xcworkspace \
90-
-scheme "$(SCHEME)" \
91-
-testPlan AllTests \
92-
-destination platform="$$platform" | xcpretty || exit 1; \
93-
done
94-
95-
test-auth:
96-
$(MAKE) SCHEME=Auth test-library
97-
98-
test-functions:
99-
$(MAKE) SCHEME=Functions test-library
100-
101-
test-postgrest:
102-
$(MAKE) SCHEME=PostgREST test-library
103-
104-
test-realtime:
105-
$(MAKE) SCHEME=Realtime test-library
106-
107-
test-storage:
108-
$(MAKE) SCHEME=Storage test-library
109-
11058
test-integration: dot-env
111-
set -o pipefail && \
112-
xcodebuild test \
113-
-skipMacroValidation \
114-
-workspace Supabase.xcworkspace \
115-
-scheme Supabase \
116-
-testPlan Integration \
117-
-destination platform="$(PLATFORM_IOS)" | xcpretty
118-
119-
120-
test-linux:
121-
docker build -t supabase-swift .
122-
docker run supabase-swift
59+
$(MAKE) TEST_PLAN=Integration xcodebuild
12360

12461
build-for-library-evolution:
12562
swift build \
@@ -141,19 +78,10 @@ test-docs:
14178
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
14279
&& exit 1)
14380

144-
build-example:
145-
xcodebuild build \
146-
-skipMacroValidation \
147-
-workspace Supabase.xcworkspace \
148-
-scheme "$(SCHEME)" \
149-
-destination platform="$(PLATFORM_IOS)" \
150-
-derivedDataPath ~/.derivedData | xcpretty;
151-
152-
15381
format:
15482
@swift format -i -r --ignore-unparsable-files .
15583

156-
.PHONY: test-library test-linux build-example
84+
.PHONY: build-for-library-evolution format xcodebuild test-docs test-integration
15785

15886
define udid_for
15987
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')

0 commit comments

Comments
 (0)