forked from davidB/kubectl-view-allocations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
150 lines (134 loc) · 5.16 KB
/
Makefile.toml
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
150
# see https://crates.io/crates/cargo-make
[env]
RUST_TEST_THREADS = "1"
CARGO_MAKE_TEST_COVERAGE_BINARY_FILTER = "cli-[a-z0-9]*$\\|makers-[a-z0-9]*$\\|${CARGO_MAKE_TEST_COVERAGE_DEFAULT_BINARY_FILTER}"
# TARGET is {arch}-{vendor}-{sys}-{abi} the output of rustc --print target-list
TARGET_AUTO = { source = "${CARGO_MAKE_RUST_TARGET_ARCH}-${CARGO_MAKE_RUST_TARGET_VENDOR}-${CARGO_MAKE_RUST_TARGET_OS}-${CARGO_MAKE_RUST_TARGET_ENV}", mapping = { x86_64-apple-macos- = "x86_64-apple-darwin" } }
TARGET = { condition = { env_not_set = ["TARGET"] }, value = "${TARGET_AUTO}" }
LIBZ_SYS_STATIC = "1"
PKG_CONFIG_ALLOW_CROSS = "1"
# see https://github.com/naftulikay/rust-openssl-static-example
OPENSSL_STATIC = "1"
# OPENSSL_LIB_DIR="/usr/lib64"
# OPENSSL_INCLUDE_DIR="/usr/include/openssl"
CARGO_BUILD_CMD = { source = "${CROSS}", default_value = "cargo", mapping = { true = "cross" } }
[tasks.init.mac.env]
# workaround for "____chkstk_darwin ... which was built for Mac OS X 10.15 /usr/lib/libSystem.B.dylib"
# see https://github.com/sharkdp/bat/issues/680
# if DevelopmentTools.clang_build_version >= 1010
CFLAGS = "-fno-stack-check"
#RUSTFLAGS = "-Clink-args=-Wl,-bind_at_load"
# XCode --mmacosx-version-min=10.9 ?
MACOSX_DEPLOYMENT_TARGET = "10.9"
[tasks.dist_env.env]
DIST_VERSION = "${CARGO_MAKE_CRATE_VERSION}"
DIST_NAME = "${CARGO_MAKE_CRATE_NAME}_${DIST_VERSION}-${TARGET}"
DIST_EXT = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "tar.gz", mapping = { windows = "zip" } }
DIST_PATH = "target/dist/${DIST_NAME}"
[tasks.debug]
dependencies = ["dist_env"]
script_runner = "@duckscript"
script = ['''
echo "PROFILE=${PROFILE}"
echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}"
echo "FILE=${DIST_PATH}.${DIST_EXT}"
echo "TARGET=${TARGET}"
echo "DIST_VERSION=${DIST_VERSION}"
echo "TAG=${TAG}"
echo "GITHUB_REF=${GITHUB_REF}"
echo "CARGO_BUILD_CMD=${CARGO_BUILD_CMD}"
echo ${CARGO_MAKE_PROFILE} : ${DIST_PATH} : ${platform}
''']
[tasks.zip-release-ci-flow]
description = "Compiles the binary in release mode and zips it up"
category = "CI"
condition = { env_set = ["TARGET"] }
dependencies = [
# "clean",
"dist_env",
"build-release-for-target",
"zip-release-binary-for-target",
]
script_runner = "@duckscript"
script = ['''
echo "::set-output name=dist_file_path::${DIST_PATH}.${DIST_EXT}"
echo "::set-output name=dist_file_name::${DIST_NAME}.${DIST_EXT}"
echo "::set-output name=dist_version::${DIST_VERSION}"
''']
[tasks.setup-cross]
description = "Install cross from https://github.com/cross-rs/cross"
condition = { env_set = ["TARGET", "CROSS"] }
install_crate = { crate_name = "cross", binary = "cross", test_arg = "--help" }
[tasks.build-release-for-target]
description = "Makes a release build for a given target"
condition = { env_set = ["TARGET"] }
dependencies = ["setup-cross"]
command = "${CARGO_BUILD_CMD}"
args = ["build", "--release", "--all-features", "--target", "${TARGET}"]
[tasks.zip-release-binary-for-target]
windows_alias = "zip-release-binary-for-target_windows"
description = "Zips up the release binary, README, and license(s)"
category = "Publish"
condition = { env_set = ["TARGET"] }
# env = { "LIBZ_SYS_STATIC" = "1", "PKG_CONFIG_ALLOW_CROSS" = "1" }
script_runner = "@shell"
script = [
'''
rm -Rf ${DIST_PATH}*
mkdir -p ${DIST_PATH}
cp target/${TARGET}/release/${CARGO_MAKE_CRATE_NAME} ${DIST_PATH}/
strip ${DIST_PATH}/${CARGO_MAKE_CRATE_NAME}
cp LICENSE* ${DIST_PATH}/ || echo "ignore if no LICENSE"
# "cp README* ${DIST_PATH}/
tar -czvf "${DIST_PATH}.${DIST_EXT}" -C "${DIST_PATH}" "${CARGO_MAKE_CRATE_NAME}" "LICENSE.txt"
''',
]
[tasks.zip-release-binary-for-target_windows]
script_runner = "powershell"
script_extension = "ps1"
script = [
'''
Set-PSDebug -Strict # -Trace 1
$ErrorActionPreference = "Stop"
Remove-Item -Recurse -Force "${env:DIST_PATH}" -ErrorAction SilentlyContinue
New-Item -ItemType directory -Path "${env:DIST_PATH}"
Copy-Item -Path "target\\${env:TARGET}\\release\\${env:CARGO_MAKE_CRATE_NAME}.exe" -Destination "${env:DIST_PATH}"
Copy-Item -Path "LICENSE*" -Destination "${env:DIST_PATH}"
# Copy-Item -Path "README*" -Destination "${env:DIST_PATH}"
Compress-Archive -Path "${env:DIST_PATH}\\*" -DestinationPath "${env:DIST_PATH}.${env:DIST_EXT}" -CompressionLevel Optimal -Force
''',
]
[tasks.update-changelog]
category = "Publish"
install_crate = { crate_name = "gitmoji-changelog", binary = "gitmoji-changelog", test_arg = "--help" }
script = ['''
rm -Rf CHANGELOG.md
gitmoji-changelog -r x.y.z-dev -o CHANGELOG.md .
''']
[tasks.update-book]
category = "Publish"
install_crate = { crate_name = "mdbook", binary = "mdbook", test_arg = "--help" }
script = ['''
cd docs
mdbook clean
mdbook build
''']
[tasks.update-bom]
category = "Publish"
install_crate = { crate_name = "cargo-bom", binary = "cargo", test_arg = "bom" }
script = ["cargo bom > BOM.txt"]
[tasks.pre-publish]
dependencies = ["update-docs"]
[tasks.update-docs]
env = { COMMIT_MSG = ":pencil: pre-publish update book, changelog" }
run_task = "_update-docs-do"
[tasks._update-docs-do]
dependencies = [
"update-changelog",
"update-bom",
"git-add",
"git-commit-message",
]
[tasks.publish]
command = "cargo"
args = ["release", "${@}"]