ci: Update

This commit is contained in:
Anmol Sethi 2022-12-02 12:10:11 -08:00
parent 61fdf07a2e
commit d20a448227
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
3 changed files with 51 additions and 29 deletions

View file

@ -23,7 +23,12 @@ pick() {
shift shift
seed_file="$(mktemp)" seed_file="$(mktemp)"
echo "$seed" > "$seed_file" echo "$seed" >"$seed_file"
# We add 16 more bytes to the seed file for sufficient entropy. Otherwise Cygwin's sort
# for example complains and I'm sure there are more platforms that would too.
# edit: nvm disabled for now, we don't use Cygwin anyway, we use MinGW who has a sort
# that behaves correctly.
# echo "================" >"$seed_file"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
echo "$1" echo "$1"
@ -85,11 +90,16 @@ _echo() {
printf '%s\n' "$*" printf '%s\n' "$*"
} }
get_rand_color() {
# 1-6 are regular and 9-14 are bright. # 1-6 are regular and 9-14 are bright.
# 1,2 and 9,10 are red and green but we use those for success and failure. get_rand_color() {
pick "$*" 1 2 3 4 5 6 \ colors=""
9 10 11 12 13 14 ncolors=$(command tput colors)
if [ "$ncolors" -ge 8 ]; then
colors="$colors 1 2 3 4 5 6"
elif [ "$ncolors" -ge 16 ]; then
colors="$colors 9 10 11 12 13 14"
fi
pick "$*" $colors
} }
echop() { echop() {
@ -301,27 +311,28 @@ LIB_RELEASE=1
goos() { goos() {
case $1 in case $1 in
macos) echo darwin ;; macos) echo darwin;;
*) echo $1 ;; *) echo $1;;
esac esac
} }
os() { os() {
uname=$(uname) uname=$(uname)
case $uname in case $uname in
Linux) echo linux ;; Linux) echo linux;;
Darwin) echo macos ;; Darwin) echo macos;;
FreeBSD) echo freebsd ;; FreeBSD) echo freebsd;;
*) echo "$uname" ;; CYGWIN_NT*|MINGW32_NT*) echo windows;;
*) echo "$uname";;
esac esac
} }
arch() { arch() {
uname_m=$(uname -m) uname_m=$(uname -m)
case $uname_m in case $uname_m in
aarch64) echo arm64 ;; aarch64) echo arm64;;
x86_64) echo amd64 ;; x86_64) echo amd64;;
*) echo "$uname_m" ;; *) echo "$uname_m";;
esac esac
} }

2
ci/sub

@ -1 +1 @@
Subproject commit 4d9ab8f8d7fb298a7b1b948b8910986b9703f2bd Subproject commit 98bd6a2a9a1a4e4051326c0f32d158570fe05977

View file

@ -28,7 +28,12 @@ pick() {
shift shift
seed_file="$(mktemp)" seed_file="$(mktemp)"
echo "$seed" > "$seed_file" echo "$seed" >"$seed_file"
# We add 16 more bytes to the seed file for sufficient entropy. Otherwise Cygwin's sort
# for example complains and I'm sure there are more platforms that would too.
# edit: nvm disabled for now, we don't use Cygwin anyway, we use MinGW who has a sort
# that behaves correctly.
# echo "================" >"$seed_file"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
echo "$1" echo "$1"
@ -90,11 +95,16 @@ _echo() {
printf '%s\n' "$*" printf '%s\n' "$*"
} }
get_rand_color() {
# 1-6 are regular and 9-14 are bright. # 1-6 are regular and 9-14 are bright.
# 1,2 and 9,10 are red and green but we use those for success and failure. get_rand_color() {
pick "$*" 1 2 3 4 5 6 \ colors=""
9 10 11 12 13 14 ncolors=$(command tput colors)
if [ "$ncolors" -ge 8 ]; then
colors="$colors 1 2 3 4 5 6"
elif [ "$ncolors" -ge 16 ]; then
colors="$colors 9 10 11 12 13 14"
fi
pick "$*" $colors
} }
echop() { echop() {
@ -437,27 +447,28 @@ LIB_RELEASE=1
goos() { goos() {
case $1 in case $1 in
macos) echo darwin ;; macos) echo darwin;;
*) echo $1 ;; *) echo $1;;
esac esac
} }
os() { os() {
uname=$(uname) uname=$(uname)
case $uname in case $uname in
Linux) echo linux ;; Linux) echo linux;;
Darwin) echo macos ;; Darwin) echo macos;;
FreeBSD) echo freebsd ;; FreeBSD) echo freebsd;;
*) echo "$uname" ;; CYGWIN_NT*|MINGW32_NT*) echo windows;;
*) echo "$uname";;
esac esac
} }
arch() { arch() {
uname_m=$(uname -m) uname_m=$(uname -m)
case $uname_m in case $uname_m in
aarch64) echo arm64 ;; aarch64) echo arm64;;
x86_64) echo amd64 ;; x86_64) echo amd64;;
*) echo "$uname_m" ;; *) echo "$uname_m";;
esac esac
} }