-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ssleert
committed
Feb 26, 2023
1 parent
19af770
commit f7416c6
Showing
9 changed files
with
154 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.2.0 | ||
0.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
58b8ac7 | ||
19af770 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.2.0 | ||
0.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
CGO_ENABLED=0 go build -ldflags="-s -w" -gcflags=all="-B -C" cmd/zfxtop/zfxtop.go | ||
CGO_ENABLED=0 | ||
|
||
main() { | ||
generate | ||
go build -ldflags="-s -w" -gcflags=all="-B -C" cmd/zfxtop/zfxtop.go | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
go fmt ./... | ||
go generate ./... | ||
main() { | ||
format | ||
generate | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
export CLR_RESET='\033[1;0m' | ||
export STL_BOLD='\033[1;1m' | ||
export CLR_RED='\033[0;31m' | ||
export CLR_GREEN='\033[0;32m' | ||
export CLR_BLUE='\033[0;34m' | ||
|
||
has() { | ||
_cmd=$(command -v "$1") 2> /dev/null || return 1 | ||
[ -x "$_cmd" ] || return 1 | ||
} | ||
|
||
msg() { | ||
printf "${CLR_BLUE}${STL_BOLD}::${CLR_RESET} ${STL_BOLD}%s${CLR_RESET}\n" "$1" | ||
shift | ||
for i in "$@"; do | ||
printf " ${CLR_BLUE}${STL_BOLD}|${CLR_RESET} ${STL_BOLD}%s${CLR_RESET}\n" "$i" | ||
done | ||
} | ||
|
||
compl() { | ||
printf "${CLR_GREEN}${STL_BOLD}>>>${CLR_RESET} ${STL_BOLD}%s${CLR_RESET}\n" "$1" | ||
shift | ||
for i in "$@"; do | ||
printf " ${CLR_GREEN}${STL_BOLD}|${CLR_RESET} ${STL_BOLD}%s${CLR_RESET}\n" "$i" | ||
done | ||
} | ||
|
||
err() { | ||
printf "${CLR_RED}${STL_BOLD}error:${CLR_RESET} ${STL_BOLD}%s${CLR_RESET}\n" "$1" | ||
shift | ||
for i in "$@"; do | ||
printf " ${CLR_RED}${STL_BOLD}|${CLR_RESET} ${STL_BOLD}%s${CLR_RESET}\n" "$i" | ||
done | ||
} | ||
|
||
die() { | ||
err "$@" | ||
exit 1 | ||
} | ||
|
||
generate() { | ||
go generate ./... | ||
compl "files generated" | ||
} | ||
|
||
format() { | ||
go fmt ./... | ||
compl "files formated" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,82 @@ | ||
#!/bin/sh | ||
. "scripts/lib.sh" | ||
|
||
CGO_ENABLED=0 | ||
NAME='zfxtop' | ||
VERSION="$(cat VERSION)" | ||
RELEASE='./release' | ||
BDIR="${RELEASE}/bin" | ||
PDIR="${RELEASE}/pkg" | ||
|
||
ARCHES=' | ||
386 | ||
amd64 | ||
' | ||
OSES=' | ||
linux | ||
' | ||
|
||
go generate ./... | ||
GOARCH=386 go build -ldflags="-s -w" -gcflags=all="-B -C" -o "release/zfxtop_386" cmd/zfxtop/zfxtop.go | ||
GOARCH=amd64 go build -ldflags="-s -w" -gcflags=all="-B -C" -o "release/zfxtop_amd64" cmd/zfxtop/zfxtop.go | ||
# sorry but now without arm support( | ||
|
||
clear() { | ||
[ -d "$RELEASE" ] && { | ||
rm -r "$RELEASE" | ||
msg "'$RELEASE' dir removed" | ||
} | ||
|
||
mkdir "$RELEASE" | ||
msg "'$RELEASE' dir created" | ||
} | ||
|
||
compile() { | ||
mkdir "$BDIR" | ||
msg "'$BDIR' created" | ||
|
||
for arch in $ARCHES; do | ||
for os in $OSES; do | ||
GOARCH="$arch" GOOS="$os" go build -ldflags="-s -w" -gcflags=all="-B -C" -o "${BDIR}/${NAME}_${VERSION}_${os}_${arch}" "cmd/${NAME}/${NAME}.go" | ||
[ $? -ne 0 ] && { | ||
die "exeption during compilation" | ||
} | ||
msg "'${BDIR}/${NAME}_${VERSION}_${os}_${arch}' builded" | ||
done | ||
done | ||
compl "all executables builded" | ||
} | ||
|
||
package() { | ||
mkdir "$PDIR" | ||
msg "'$PDIR' created" | ||
|
||
for arch in $ARCHES; do | ||
for os in $OSES; do | ||
tar -czf "${PDIR}/${NAME}_${VERSION}_${os}_${arch}.tar.gz" "${BDIR}/${NAME}_${VERSION}_${os}_${arch}" | ||
[ $? -ne 0 ] && { | ||
die "exeption during packaging" | ||
} | ||
msg "'${PDIR}/${NAME}_${VERSION}_${os}_${arch}.tar.gz' packaged" | ||
done | ||
done | ||
compl "all executables packaged" | ||
} | ||
|
||
gen_checksum() { | ||
cd "$PDIR" | ||
msg "dir changed to '$PDIR'" | ||
sha256sum *.tar.gz > checksums.txt | ||
compl "checksums for '$PDIR' generated" | ||
cd "../../" | ||
msg "dir chenged to '$PWD'" | ||
} | ||
|
||
main() { | ||
clear | ||
format | ||
generate | ||
compile | ||
package | ||
gen_checksum | ||
compl "ALL COMPLETED" | ||
} | ||
|
||
main |