-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathTaskfile.yml
More file actions
99 lines (87 loc) · 3.61 KB
/
Taskfile.yml
File metadata and controls
99 lines (87 loc) · 3.61 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
version: "3"
silent: true
tasks:
build:
cmds:
- |
echo "// SPDX-License-Identifier: Apache-2.0
/// Contains SDK version information.
public enum VersionInfo {
/// The current version of the Hiero SDK.
public static let version = \"$(git describe --tags $(git rev-list --tags --max-count=1))-dev\"
}" > Sources/Hiero/Version.swift
- swift build
format:
deps: [swift-format:install]
cmds:
- .build/swift-format/swift-format --configuration .swift-format.json --recursive --in-place --parallel Sources/ Tests/ Examples/ Package.swift
lint:
deps: [swift-format:install]
cmds:
- cmd: swiftlint --quiet
ignore_error: true
- .build/swift-format/swift-format lint --configuration .swift-format.json --recursive --parallel Sources/ Tests/ Examples/ Package.swift
swift-format:install:
desc: "Install swift-format 600.0.0 (matches CI)"
vars:
SWIFT_FORMAT_VERSION: "600.0.0"
status:
- test -f .build/swift-format/swift-format
cmds:
- rm -rf .build/swift-format-src .build/swift-format
- git clone --depth=1 --branch {{.SWIFT_FORMAT_VERSION}} https://github.com/apple/swift-format.git .build/swift-format-src
- cd .build/swift-format-src && swift build -c release
- mkdir -p .build/swift-format
- cp .build/swift-format-src/.build/release/swift-format .build/swift-format/
- rm -rf .build/swift-format-src
- echo "Installed swift-format {{.SWIFT_FORMAT_VERSION}}"
package:
desc: "Build package"
cmds:
- |
echo "// SPDX-License-Identifier: Apache-2.0
/// Contains SDK version information.
public enum VersionInfo {
/// The current version of the Hiero SDK.
public static let version = \"$(git describe --tags)\"
}" > Sources/Hiero/Version.swift
- swift build -c release
example:
desc: "Run example"
cmds:
- swift run {{.name}}Example
submodule:fetch:
desc: "Fetch a specific version of the submodule, or else the latest version. E.g. task submodule:fetch proto=vX.Y.Z"
dir: protobufs
vars:
latest_tag:
sh: >
git tag -l --sort=version:refname |
grep -v 'alpha\|beta\|rc' |
tail -1
proto: "{{.proto | default .latest_tag}}"
current_version:
sh: git describe --tags
cmds:
- echo "Protobuf version set to {{.proto}}"
- |
if [ "{{.current_version}}" = "{{.proto}}" ]; then
echo "Warning: Already at version {{.proto}}, skipping update"
exit 0
fi
- git fetch origin
- git checkout {{.proto}}
- git show-ref --verify -q refs/heads/{{.proto}} && git pull origin || exit 0
- cd ..
- task: submodule:generate
vars:
proto: "{{.proto}}"
- task: build
- echo "Successfully updated protobufs to {{.proto}}"
submodule:generate:
desc: "Generate the swift files from the protobufs"
dir: Sources/HieroProtobufs
cmds:
- cmd: python3 update_protos.py --version {{.proto}}
- cmd: python3 sync_status_codes.py
- cmd: task format