-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.justfile
More file actions
98 lines (86 loc) · 2.61 KB
/
.justfile
File metadata and controls
98 lines (86 loc) · 2.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
BINNAME := "tomato"
RELATIVE_TAP_PATH := "../../../homebrew-tap/"
_help:
just -l
# Run all tests using nextest.
test:
cargo nextest run
# Format the code.
fmt:
cargo +nightly fmt
# Run the same checks we run in CI. Requires nightly.
ci: test fmt
cargo clippy --all-targets
# Ask for clippy's opinion.
lint: fmt
cargo clippy --fix
# Install required tools
setup:
#!/usr/bin/env bash
if [[ -z $(which cargo) ]]; then
printf "Installing 🦀 {{BOLD}}{{RED}}Rust{{RESET}}...\n"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
else
rustup update
fi
rustup target add x86_64-apple-darwin
rustup install nightly
brew tap --quiet ceejbot/tap
brew install --quiet fzf semver-bump formulaic cargo-nextest
# Use tomato to set the crate version to the passed in version, commit,
# and create a git tag `v{version}`. Will not act if there are uncommitted
# changes extant.
# Tag a new version for release.
version BUMP:
#!/usr/bin/env bash
set -e
current=$(cargo run --quiet -- get package.version Cargo.toml)
version=$(semver-bump {{BUMP}} $current)
cargo run --quiet -- set package.version "$version" Cargo.toml &> /dev/null
cargo generate-lockfile
git commit Cargo.toml Cargo.lock -m "v${version}"
git tag "v${version}"
printf "Release tagged for version {{BOLD_YELLOW}}v${version}{{RESET}}\n"
# Release by hand instead of in action.
release:
#!/usr/bin/env bash
set -e
mkdir -p dist
cd dist
tag=$(git describe --tags --abbrev=0)
# fails if this already exists
release_url=$(gh release create "$tag" --generate-notes)
for target in "aarch64-apple-darwin" "x86_64-apple-darwin"; do
cargo +stable build --release --target $target
tar czf {{ BINNAME }}-$target.tar.gz --strip-components=2 target/$target/release/{{ BINNAME }}
gh release upload "$tag" "{{ BINNAME }}-$target.tar.gz"
sha256sum {{ BINNAME }}-$target.tar.gz > {{ BINNAME }}-"$target".tar.gz.sha256
gh release upload "$tag" "{{ BINNAME }}-$target.tar.gz.sha256"
done
formula_file=$(formulaic ../Cargo.toml)
mv dist/$formula_file {{RELATIVE_TAP_PATH}}/Formula/
cd {{RELATIVE_TAP_PATH}} || exit
git add Formula/$(basename $formula_file)
git commit -m "$(basename -s .rb $formula_file) $tag"
RESET := "\\e[0m"
BOLD := "\\e[1m"
BOLD_YELLOW := "\\e[1;33m"
BOLD_BLUE := "\\e[1;34m"
BLACK := "\\e[30m"
BLACK_BG := "\\e[40m"
RED := "\\e[31m"
RED_BG := "\\e[41m"
GREEN := "\\e[32m"
GREEN_BG := "\\e[42m"
YELLOW := "\\e[33m"
YELLOW_BG := "\\e[43"
BLUE := "\\e[34m"
BLUE_BG:= "\\e[44m"
MAGENTA := "\\e[35m"
MAGENTA_BG := "\\e[45m"
CYAN := "\\e[36m"
CYAN_BG := "\\e[46m"
WHITE := "\\e[37m"
WHITE_BG := "\\e[47m"
DEFAULT := "\\e[39m"
DEFAULT_BG := "\\e[49m"