forked from supabase/supabase-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
116 lines (94 loc) · 3.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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,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 ?= $(PLATFORM_IOS)
export SECRETS
define SECRETS
enum DotEnv {
static let SUPABASE_URL = "$(SUPABASE_URL)"
static let SUPABASE_ANON_KEY = "$(SUPABASE_ANON_KEY)"
static let SUPABASE_SERVICE_ROLE_KEY = "$(SUPABASE_SERVICE_ROLE_KEY)"
}
endef
load-env:
@. ./scripts/load_env.sh
dot-env:
@echo "$$SECRETS" > Tests/IntegrationTests/DotEnv.swift
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
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.xcworkspace \
-scheme Supabase \
-testPlan Integration \
-destination platform="$(PLATFORM_IOS)" | xcpretty
test-linux:
docker build -t supabase-swift .
docker run supabase-swift
build-for-library-evolution:
swift build \
-c release \
--target Supabase \
-Xswiftc -emit-module-interface \
-Xswiftc -enable-library-evolution
DOC_WARNINGS = $(shell xcodebuild clean docbuild \
-scheme Supabase \
-destination platform="$(PLATFORM_MACOS)" \
-quiet \
2>&1 \
| grep "couldn't be resolved to known documentation" \
| sed 's|$(PWD)|.|g' \
| tr '\n' '\1')
test-docs:
@test "$(DOC_WARNINGS)" = "" \
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
&& exit 1)
build-examples:
for scheme in Examples UserManagement SlackClone; do \
set -o pipefail && \
xcodebuild build \
-skipMacroValidation \
-workspace Supabase.xcworkspace \
-scheme "$$scheme" \
-destination platform="$(PLATFORM_IOS)" | xcpretty; \
done
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