-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (53 loc) · 1.73 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
.PHONY: magic version
export PRJ_NAME=ISO639.swift
export TAG=$(shell git rev-list --tags --max-count=1)
export VERSION=$(shell git describe --tags $(TAG))
export PRJ_PATH=$(shell pwd)
export BUILD_PATH=$(PRJ_PATH)/.build
export BIN_BUILD_PATH=$(shell swift build --show-bin-path)
export CODECOV_JSON_PATH=$(shell swift test --show-codecov-path)
export XCTEST_FILE_PATH=$(BIN_BUILD_PATH)/$(PRJ_NAME)PackageTests.xctest/Contents/MacOS/$(PRJ_NAME)PackageTests
clean:
swift package clean
force-clean:
rm -rf .build
build: version
swift build -v
test-macos-xcode:
set -o pipefail && \
xcodebuild test \
-scheme $(PRJ_NAME) \
-destination platform="macOS" \
-parallel-testing-enabled YES \
-enableCodeCoverage YES \
-derivedDataPath .build/derivedData
test-macos-spm:
swift test --parallel --enable-code-coverage
xcrun llvm-cov report \
-instr-profile=$(BIN_BUILD_PATH)/codecov/default.profdata \
-arch=x86_64 \
$(XCTEST_FILE_PATH)
xcrun llvm-cov show \
-instr-profile=$(BIN_BUILD_PATH)/codecov/default.profdata \
-arch=x86_64 \
-o $(BUILD_PATH)/CodeCoverageReport \
--format=html \
$(XCTEST_FILE_PATH)
show-coverage:
open $(BUILD_PATH)/CodeCoverageReport/index.html
test-all: test-macos-spm test-macos-xcode
all: env build test-all show-coverage
upload_to_codecov:
curl -s https://codecov.io/bash > $(BUILD_PATH)/codecov.bash
chmod 755 $(BUILD_PATH)/codecov.bash
$(BUILD_PATH)/codecov.bash -J "$(PRJ_NAME)" -D $(BUILD_PATH)/derivedData
release-pod: version
pod lib lint --allow-warnings
pod trunk push --allow-warnings
version:
@echo TAG: $(TAG)
@echo VERSION: $(VERSION)
env: version
@echo CODECOV_JSON_PATH: $(CODECOV_JSON_PATH)
@echo BUILD_PATH: $(BUILD_PATH)
@echo BIN_BUILD_PATH: $(BIN_BUILD_PATH)