-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
83 lines (69 loc) · 3.35 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
MACOS_VERSION := $(shell xcodebuild -showsdks | grep -m 1 'sdk macosx' | sed 's/\(.*macosx\)\(.*\)/\2/')
IOS_VERSION := $(shell xcodebuild -showsdks | grep -m 1 'sdk iphoneos' | sed 's/\(.*iphoneos\)\(.*\)/\2/')
WATCHOS_VERSION := $(shell xcodebuild -showsdks | grep -m 1 'sdk watchos' | sed 's/\(.*watchos\)\(.*\)/\2/')
IS_CI=$(shell [ ! -z "$$CI" ] && echo "1")
ARCH=arch -$(shell [ $(IS_CI) ] && echo "x86_64" || echo "arm64")
PIPEFAIL=set -o pipefail
XCPRETTY=bundle exec xcpretty
TEST=$(PIPEFAIL) && $(ARCH) xcodebuild test -disableAutomaticPackageResolution -skipPackageUpdates -project Stytch/Stytch.xcodeproj -scheme StytchCoreTests -sdk
UI_UNIT_TESTS=$(PIPEFAIL) && $(ARCH) xcodebuild test -disableAutomaticPackageResolution -skipPackageUpdates -project Stytch/Stytch.xcodeproj -scheme StytchUIUnitTests -sdk
HOSTING_BASE_PATH=$(shell echo stytch-ios/$$REF | sed 's:/$$::')
.PHONY: coverage
coverage:
@if [ ! -f $$(Scripts/coverage instr-profile-path) ]; then $(MAKE) test; fi
$(ARCH) Scripts/coverage generate-html
$(ARCH) Scripts/coverage generate-json
.PHONY: codegen
codegen:
$(ARCH) mint run sourcery --templates Resources/Sourcery/Templates --sources Sources --output Sources --parseDocumentation
.PHONY: docs
docs: codegen
$(ARCH) xcodebuild clean docbuild -scheme StytchCore -configuration Release -sdk iphoneos$(IOS_VERSION) -destination generic/platform=iOS -derivedDataPath .build | $(XCPRETTY)
$(ARCH) xcodebuild clean docbuild -scheme StytchUI -configuration Release -sdk iphoneos$(IOS_VERSION) -destination generic/platform=iOS -derivedDataPath .build | $(XCPRETTY)
.PHONY: docs-site
docs-site: docs
mkdir -p .build/docs/StytchCore
mkdir -p .build/docs/StytchUI
$(ARCH) $$(xcrun --find docc) process-archive transform-for-static-hosting .build/Build/Products/Release-iphoneos/StytchCore.doccarchive --output-path .build/docs/StytchCore --hosting-base-path $(HOSTING_BASE_PATH)/StytchCore/
$(ARCH) $$(xcrun --find docc) process-archive transform-for-static-hosting .build/Build/Products/Release-iphoneos/StytchUI.doccarchive --output-path .build/docs/StytchUI --hosting-base-path $(HOSTING_BASE_PATH)/StytchUI/
.PHONY: format
format:
$(ARCH) mint run swiftformat .
.PHONY: lint
lint:
$(ARCH) mint run swiftlint lint --quiet --strict
$(ARCH) mint run swiftformat --lint .
.PHONY: setup
setup:
$(ARCH) brew bundle
@if [ ! $$NO_BUNDLE ]; then $(ARCH) bundle install; fi
.PHONY: test-all
test-all: codegen
$(MAKE) test
$(MAKE) test-ios
$(MAKE) test-tvos
$(MAKE) test-watchos
.PHONY: test tests test-macos
test tests test-macos: codegen
@xcodebuild -showsdks
@xcrun simctl list devices
$(TEST) macosx14.0 -destination "OS=14.0,platform=macOS" -enableCodeCoverage YES -derivedDataPath .build | $(XCPRETTY)
.PHONY: test-ios
test-ios: codegen
@xcodebuild -showsdks
@xcrun simctl list devices
$(TEST) iphonesimulator17.0 -destination "OS=17.2,name=iPhone 15 Pro" | $(XCPRETTY)
$(UI_UNIT_TESTS) iphonesimulator17.0 -destination "OS=17.2,name=iPhone 15 Pro" | $(XCPRETTY)
.PHONY: test-tvos
test-tvos: codegen
@xcodebuild -showsdks
@xcrun simctl list devices
$(TEST) appletvsimulator17.0 -destination "OS=17.0,name=Apple TV" | $(XCPRETTY)
.PHONY: test-watchos
test-watchos: codegen
@xcodebuild -showsdks
@xcrun simctl list devices
$(TEST) watchsimulator10.0 -destination "OS=10.0,name=Apple Watch Ultra (49mm)" | $(XCPRETTY)
.PHONY: tools
tools:
$(ARCH) mint bootstrap