-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
33 lines (29 loc) · 1.22 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
PLATFORM_IOS = iOS Simulator,name=iPhone 11
PLATFORM_MACOS = macOS
PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p)
default: test
test:
xcodebuild test \
-scheme ArrowView-Package \
-destination platform="$(PLATFORM_IOS)" \
-enableCodeCoverage YES ENABLE_TESTING_SEARCH_PATHS=YES
# Extract coverage info for ArrowView.swift -- expects defintion of env variable GITHUB_ENV
PROJECT = ArrowView
coverage:
@-rm -f cov.txt percentage.txt
@for XCTEST_PATH in $$(find $${HOME}/Library/Developer/Xcode/DerivedData -name '$(PROJECT)-*' -prune); do \
echo "-- checking $${XCTEST_PATH}"; \
OBJ="$${XCTEST_PATH}/Build/Products/Debug-iphonesimulator/$(PROJECT).framework/${PROJECT}"; \
set -- $${XCTEST_PATH}/Build/ProfileData/*/Coverage.profdata; \
if [[ -f "$${1}" && -f "$${OBJ}" ]]; then \
echo "-- generaing coverage from $${1}"; \
xcrun llvm-cov report "$${OBJ}" -instr-profile "$${1}" > cov.txt; \
fi; \
done; \
[[ -f cov.txt ]] || { echo "** no coverage report found"; exit 1; \\; }
@tail -1 cov.txt | awk '{ print $$10; }' > percentage.txt
@echo "-- PERCENTAGE=$$(< percentage.txt)"
@if [[ -n "$$GITHUB_ENV" ]]; then \
echo "PERCENTAGE=$$(< percentage.txt)" >> $$GITHUB_ENV; \
fi
.PHONY: test coverage