forked from MakeupStudio/combine-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (39 loc) · 1.33 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
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.2,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17,TV)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10,Watch)
default: test-all
test-all:
$(MAKE) test
$(MAKE) test-docs
test:
$(MAKE) CONFIG=debug test-library
test-library:
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_WATCHOS)"; do \
echo "\nTesting library on $$platform\n" && \
(xcodebuild test \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme CombineExtensionsTests \
-destination platform="$$platform" | xcpretty && exit 0 \
) \
|| exit 1; \
done;
DOC_WARNINGS = $(shell xcodebuild clean docbuild \
-scheme Interception \
-destination platform="$(PLATFORM_IOS)" \
-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)
define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef