Skip to content

Commit 9bc4ab8

Browse files
committed
Release helper script added.
1 parent 4970172 commit 9bc4ab8

File tree

3 files changed

+94
-3
lines changed

3 files changed

+94
-3
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: cargo build --release --verbose
3333
- name: Run tests
3434
run: cargo test --verbose
35-
build-macos-arm64:
35+
build-macos-arm64:
3636
runs-on: macos-14
3737
steps:
3838
- uses: actions/checkout@v3

mkrelease.sh

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/bash
2+
## ANSI Colors (FG & BG)
3+
RED="$(printf '\033[31m')" GREEN="$(printf '\033[32m')" YELLOW="$(printf '\033[33m')" BLUE="$(printf '\033[34m')"
4+
MAGENTA="$(printf '\033[35m')" CYAN="$(printf '\033[36m')" WHITE="$(printf '\033[37m')" BLACK="$(printf '\033[30m')"
5+
REDBG="$(printf '\033[41m')" GREENBG="$(printf '\033[42m')" YELLOWBG="$(printf '\033[43m')" BLUEBG="$(printf '\033[44m')"
6+
MAGENTABG="$(printf '\033[45m')" CYANBG="$(printf '\033[46m')" WHITEBG="$(printf '\033[47m')" BLACKBG="$(printf '\033[40m')"
7+
RESET="$(printf '\e[0m')"
8+
9+
## Globals
10+
[[ -n $VERBOSE ]] && ERR_LOG="$(tty)"
11+
12+
print_status() {
13+
echo "${YELLOW}[*] ${RESET}${1}"
14+
}
15+
16+
print_warning() {
17+
echo -n "${YELLOW}[!] ${RESET}${1}"
18+
}
19+
20+
print_error() {
21+
echo "${RED}[-] ${RESET}${1}"
22+
}
23+
24+
print_fatal() {
25+
echo -e "${RED}[!] $1\n${RESET}"
26+
kill -10 $$
27+
}
28+
29+
print_good() {
30+
echo "${GREEN}[+] ${RESET}${1}"
31+
}
32+
33+
print_verbose() {
34+
if [[ -n "${VERBOSE}" ]]; then
35+
echo "${WHITE}[*] ${RESET}${1}"
36+
fi
37+
}
38+
39+
must_exist() {
40+
for i in "$@"; do
41+
command -v "$i" >$ERR_LOG || print_fatal "$i not installed! Exiting..."
42+
done
43+
}
44+
45+
46+
## Handle SININT
47+
exit_on_signal_SIGINT () {
48+
echo ""
49+
print_fatal "Script interrupted!"
50+
}
51+
52+
exit_on_signal_SIGTERM () {
53+
echo ""
54+
print_fatal "Script interrupted!"
55+
}
56+
57+
trap exit_on_signal_SIGINT SIGINT
58+
trap exit_on_signal_SIGTERM SIGTERM
59+
60+
RELEASE_DIR="$(pwd)/release"
61+
ERR_LOG="/dev/null"
62+
63+
must_exist "grep" "cut" "tar" "sha1sum"
64+
65+
[[ ! -f ./Cargo.toml ]] && print_fatal "Cargo.toml not found!"
66+
VERSION=$(grep "^version = " Cargo.toml|cut -d'"' -f2)
67+
68+
print_status "[$(date --rfc-3339=date)] Packaging new release for version $VERSION"
69+
mkdir -p "$RELEASE_DIR" &> "$ERR_LOG"
70+
71+
tar czvf "$RELEASE_DIR/deoptimizer_linux_x86_64_v$VERSION.tar.gz"\
72+
"./target/x86_64-unknown-linux-musl/release/deoptimizer" &> "$ERR_LOG" || print_fatal "Linux x86_64 release failed!"
73+
74+
tar czvf "$RELEASE_DIR/deoptimizer_linux_i686_v$VERSION.tar.gz"\
75+
"./target/i686-unknown-linux-musl/release/deoptimizer" &> "$ERR_LOG" || print_fatal "Linux i686 release failed!"
76+
77+
tar czvf "$RELEASE_DIR/deoptimizer_linux_aarch64_v$VERSION.tar.gz"\
78+
"./target/aarch64-unknown-linux-musl/release/deoptimizer" &> "$ERR_LOG" || print_fatal "Linux aarch64 release failed!"
79+
80+
tar czvf "$RELEASE_DIR/deoptimizer_windows_x86_64_v$VERSION.tar.gz"\
81+
"./target/x86_64-pc-windows-gnu/release/deoptimizer.exe" &> "$ERR_LOG" || print_fatal "Windows x86_64 release failed!"
82+
83+
tar czvf "$RELEASE_DIR/deoptimizer_windows_i686_v$VERSION.tar.gz"\
84+
"./target/i686-pc-windows-gnu/release/deoptimizer.exe" &> "$ERR_LOG" || print_fatal "Windows i686 release failed!"
85+
86+
87+
88+
print_good "All done!"
89+
90+
cd $RELEASE_DIR
91+
echo -e "\n\`\`\`"
92+
sha1sum *
93+
echo -e "\`\`\`\n"

src/x86_64/tests.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#[cfg(test)]
22
mod tests {
3-
use std::arch::x86_64;
4-
53
use crate::x86_64::*;
64
use iced_x86::*;
75

0 commit comments

Comments
 (0)