-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathMakefile
108 lines (85 loc) · 3.97 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
TARGET = TMDb
TEST_TARGET = TMDbTests
INTEGRATION_TEST_TARGET = TMDbIntegrationTests
IOS_DESTINATION = 'platform=iOS Simulator,name=iPhone 15,OS=18.0'
WATCHOS_DESINTATION = 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=11.0'
TVOS_DESTINATION = 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.0'
VISIONOS_DESTINATION = 'platform=visionOS Simulator,name=Apple Vision Pro,OS=2.0'
SWIFT_CONTAINER_IMAGE = swift:6.0.2-jammy
.PHONY: clean
clean:
swift package clean
rm -rf docs
.PHONY: format
format:
swift format -r -p -i .
.PHONY: lint
lint:
swift format lint -r -p .
.PHONY: lint-markdown
lint-markdown:
markdownlint "README.md"
markdownlint "**/*.docc/**/*.md"
.PHONY: build
build:
swift build -Xswiftc -warnings-as-errors
.PHONY: build-tests
build-tests:
swift build --build-tests -Xswiftc -warnings-as-errors
.PHONY: build-linux
build-linux:
docker run --rm -v "$${PWD}:/workspace" -w /workspace $(SWIFT_CONTAINER_IMAGE) /bin/bash -cl "swift build -Xswiftc -warnings-as-errors
.PHONY: build-release
build-release:
swift build -c release -Xswiftc -warnings-as-errors
.PHONY: build-linux-release
build-linux-release:
docker run --rm -v "$${PWD}:/workspace" -w /workspace $(SWIFT_CONTAINER_IMAGE) /bin/bash -cl "swift build -c release -Xswiftc -warnings-as-errors"
.PHONY: build-docs
build-docs:
SWIFTCI_DOCC=1 swift package generate-documentation --warnings-as-errors
swift package resolve
.PHONY: preview-docs
preview-docs:
SWIFTCI_DOCC=1 swift package --disable-sandbox preview-documentation --target $(TARGET)
.PHONY: generate-docs
generate-docs:
SWIFTCI_DOCC=1 swift package --allow-writing-to-directory docs \
generate-documentation --target $(TARGET) \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path $(TARGET) \
--output-path docs
.PHONY: test
test:
swift build --build-tests -Xswiftc -warnings-as-errors
swift test --skip-build --filter $(TEST_TARGET)
.PHONY: test-ios
test-ios:
set -o pipefail && NSUnbufferedIO=YES xcodebuild clean build-for-testing -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(IOS_DESTINATION)
set -o pipefail && NSUnbufferedIO=YES xcodebuild test-without-building -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(IOS_DESTINATION)
.PHONY: test-watchos
test-watchos:
set -o pipefail && NSUnbufferedIO=YES xcodebuild build-for-testing -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(WATCHOS_DESINTATION)
set -o pipefail && NSUnbufferedIO=YES xcodebuild test-without-building -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(WATCHOS_DESINTATION)
.PHONY: test-tvos
test-tvos:
set -o pipefail && NSUnbufferedIO=YES xcodebuild build-for-testing -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(TVOS_DESTINATION)
set -o pipefail && NSUnbufferedIO=YES xcodebuild test-without-building -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(TVOS_DESTINATION)
.PHONY: test-visionos
test-visionos:
set -o pipefail && NSUnbufferedIO=YES xcodebuild build-for-testing -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(VISIONOS_DESTINATION)
set -o pipefail && NSUnbufferedIO=YES xcodebuild test-without-building -scheme $(TARGET) -only-testing $(TEST_TARGET) -destination $(VISIONOS_DESTINATION)
.PHONY: test-linux
test-linux:
docker run -i --rm -v "$${PWD}:/workspace" -w /workspace $(SWIFT_CONTAINER_IMAGE) /bin/bash -cl "swift build --build-tests -Xswiftc -warnings-as-errors && swift test --skip-build --filter $(TEST_TARGET)"
.PHONY: integration-test
integration-test: .check-env-vars
swift build --build-tests
swift test --skip-build --filter $(INTEGRATION_TEST_TARGET)
.PHONY: ci
ci: .check-env-vars lint lint-markdown test test-ios test-watchos test-tvos test-visionos integration-test build-release build-docs
.check-env-vars:
@test $${TMDB_API_KEY?Please set environment variable TMDB_API_KEY}
@test $${TMDB_USERNAME?Please set environment variable TMDB_USERNAME}
@test $${TMDB_PASSWORD?Please set environment variable TMDB_PASSWORD}