-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
58 lines (48 loc) · 1.64 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
PLATFORM_IOS = iOS Simulator,name=iPad mini (A17 Pro)
SCHEME = JoyStickView App
DOCC_DIR = ./docs
QUIET = -quiet
WORKSPACE = $(PWD)/JoyStickView.xcworkspace
SPM_WORKSPACE = $(PWD)/.workspace
default: post
clean:
rm -rf "$(PWD)/.DerivedData-macos" "$(PWD)/.DerivedData-ios" "$(PWD)/.DerivedData-tvos" "$(SPM_WORKSPACE)"
docc:
xcodebuild docbuild \
-workspace "$(WORKSPACE)" \
$(QUIET) \
-scheme "JoyStickView" \
-destination platform="$(PLATFORM_IOS)" \
-derivedDataPath "$(PWD)/.DerivedData-ios"
DOCC_JSON_PRETTYPRINT="YES" \
xcrun docc process-archive transform-for-static-hosting `find $(PWD)/.DerivedData-ios -type d -name *.doccarchive` \
--hosting-base-path JoystickView \
--output-path docs
lint: clean
@if command -v swiftlint; then swiftlint; fi
resolve-deps: lint
xcodebuild \
-workspace "$(WORKSPACE)" \
$(QUIET) \
-resolvePackageDependencies \
-clonedSourcePackagesDirPath "$(SPM_WORKSPACE)" \
-scheme "$(SCHEME)"
test-ios: resolve-deps
xcodebuild test \
-workspace "$(WORKSPACE)" \
$(QUIET) \
-clonedSourcePackagesDirPath "$(SPM_WORKSPACE)" \
-scheme "$(SCHEME)" \
-derivedDataPath "$(PWD)/.DerivedData-ios" \
-destination platform="$(PLATFORM_IOS)"
coverage: test-ios
@xcrun xccov view --report --only-targets $(PWD)/.DerivedData-ios/Logs/Test/*.xcresult > coverage.txt
@cat coverage.txt
percentage: coverage
@awk '/ JoyStickView.framework / { if ($$3 > 0) print $$4; }' coverage.txt > percentage.txt
@cat percentage.txt
post: percentage
@if [[ -n "$$GITHUB_ENV" ]]; then \
echo "PERCENTAGE=$$(< percentage.txt)" >> $$GITHUB_ENV; \
fi
.PHONY: test post percentage coverage test-ios resolve-deps clean