-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (67 loc) · 2.15 KB
/
Makefile
File metadata and controls
81 lines (67 loc) · 2.15 KB
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
PLATFORM_IOS = iOS Simulator,name=iPad mini (A17 Pro)
PLATFORM_MACOS = macOS
SCHEME = MathParser
DOCC_DIR = ./docs
QUIET = -quiet
WORKSPACE = $(PWD)/$(SCHEME).workspace
SKIPS = -skipMacroValidation -skipPackagePluginValidation
BUILD_FLAGS = $(SKIPS) -scheme $(SCHEME) $(QUIET) -clonedSourcePackagesDirPath "$(WORKSPACE)"
XCCOV = xcrun xccov view --report --only-targets
default: report
test-ios: lint
rm -rf "${PWD}/.DerivedData-iOS"
xcodebuild test \
$(BUILD_FLAGS) \
-derivedDataPath "$(PWD)/.DerivedData-ios" \
-destination platform="$(PLATFORM_IOS)" \
-enableCodeCoverage YES
test-tvos:
xcodebuild test \
$(BUILD_FLAGS) \
-derivedDataPath "$(PWD)/.DerivedData-tvos" \
-destination platform="$(PLATFORM_TVOS)"
test-macos:
xcodebuild test \
$(BUILD_FLAGS) \
-derivedDataPath "$(PWD)/.DerivedData-macos" \
-destination platform="$(PLATFORM_MACOS)" \
-enableCodeCoverage YES
test-linux: lint
docker build -t swiftlang -f swiftlang.dockerfile .
docker run \
--rm \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift57 \
bash -c 'make test-swift'
test-swift: lint
swift test --parallel
coverage-macos: test-macos
$(XCCOV) "$(PWD)/.DerivedData-macos/Logs/Test/"*.xcresult > coverage_macOS.txt
echo "macOS Coverage:"
cat coverage_macOS.txt
percentage-macos: coverage-macos
awk '/ $(SCHEME) / { if ($$3 > 0) print $$4; }' coverage_macOS.txt > percentage_macOS.txt
echo "macOS Percentage:"
cat percentage_macOS.txt
report: percentage-macos
@if [[ -n "$$GITHUB_ENV" ]]; then \
echo "PERCENTAGE=$$(< percentage_macOS.txt)" >> $$GITHUB_ENV; \
fi
doc:
DOCC_JSON_PRETTYPRINT="YES" \
swift package \
--allow-writing-to-directory $(DOCC_DIR) \
generate-documentation \
--target $(SCHEME) \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path swift-math-parser \
--output-path $(DOCC_DIR)
dws:
swift package --disable-sandbox preview-documentation --target MathParser
lint: clean
@if command -v swiftlint; then swiftlint; fi
clean:
rm -rf "$(PWD)/.DerivedData-macos" "$(PWD)/.DerivedData-ios" "$(PWD)/.DerivedData-tvos" "$(WORKSPACE)"
.PHONY: test test-ios test-macos test-tvos coverage percentage test-linux test-swift