-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskfile.yml
More file actions
149 lines (127 loc) · 4.39 KB
/
Copy pathtaskfile.yml
File metadata and controls
149 lines (127 loc) · 4.39 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
version: '3'
vars:
NEXT_VERSION:
sh: npx --yes entro-version version:next
NEXT_MAJOR_VERSION:
sh: npx --yes entro-version version:next --commit-and-tag-version-flag="--release-as=major"
CURRENT_VERSION:
sh: npx --yes entro-version version:get
tasks:
install-deps:
desc: "Install dependencies"
cmds:
- |
cd cli
cargo build
test-local:
desc: "Run the tests for the supported platform on the current machine"
cmds:
- |
cd cli
cargo test
test-unix:
desc: "Run the tests for the Unix supported platforms"
cmds:
- |
cd cli
cross test --target aarch64-unknown-linux-gnu \
& cross test --target x86_64-unknown-linux-gnu \
& wait
release:
desc: "Run a cargo release from develop to main using git flow"
cmds:
- |
cd cli
cargo set-version {{.NEXT_VERSION}}
git commit -am "chore(release): update cargo version"
cd ../
npx --yes entro-version release --main-branch-name=main
release-major:
desc: "Run a major release from develop to main using git flow"
cmds:
- |
cd cli
cargo set-version {{.NEXT_MAJOR_VERSION}}
git commit -am "chore(release): update cargo version"
cd ../
npx --yes entro-version release --main-branch-name=main --commit-and-tag-version-flag="--release-as=major"
ci:release:
desc: "Run a cargo release in CI without GPG signing"
cmds:
- |
cd cli
cargo set-version {{.NEXT_VERSION}}
git commit -am "chore(release): update cargo version"
cd ../
npx --yes entro-version release --main-branch-name=main --no-sign
ci:release-major:
desc: "Run a major release in CI without GPG signing"
cmds:
- |
cd cli
cargo set-version {{.NEXT_MAJOR_VERSION}}
git commit -am "chore(release): update cargo version"
cd ../
npx --yes entro-version release --main-branch-name=main --no-sign --commit-and-tag-version-flag="--release-as=major"
build-binary:
desc: "Build the binary"
cmds:
- |
cd cli
cargo build --release
build:
desc: "Build the binary - the assumption is that this is done from the main branch"
cmds:
- |
rm -rf ./release
version=v{{ .CURRENT_VERSION }}
cd cli
mkdir -p ../release
# Define target platforms
platforms=(
"aarch64-unknown-linux-gnu"
"x86_64-unknown-linux-gnu"
"x86_64-pc-windows-gnu"
)
# Clean the build directory
# cargo clean
# Build for each platform
for platform in "${platforms[@]}"; do
# Split platform into OS and architecture
IFS='-' read -r part1 part2 part3 part4 <<< "$platform"
os="$part3"
arch="$part1"
# Map Rust target names to user-friendly names
case "$os" in
"apple-darwin") os_name="macOS" ;;
"unknown-linux-gnu") os_name="linux" ;;
"pc-windows-gnu") os_name="windows" ;;
*) os_name="$os" ;;
esac
# Determine the output binary name
output_name="dockem-rs-${version}-${os_name}-${arch}"
if [ "$os_name" = "windows" ]; then
output_name+=".exe"
fi
echo "Building release/$output_name for $platform..."
# Build the binary in the background
if command -v cross &> /dev/null; then
# Use `cross` if installed
cross build --release --target "$platform" --bin "dockem-rs"
if [ "$os_name" = "windows" ]; then
mv "./target/$platform/release/dockem-rs.exe" "../release/$output_name"
else
mv "./target/$platform/release/dockem-rs" "../release/$output_name"
fi
else
# Fall back to `cargo` if `cross` is not installed
cargo build --release --target "$platform" --bin "dockem-rs" --target-dir "./target"
mv "./target/$platform/release/dockem-rs" "../release/$output_name"
fi
# Check if the build succeeded
if [ $? -ne 0 ]; then
echo "An error has occurred while building for $platform! Aborting."
exit 1
fi
done
echo "All builds completed successfully!"