-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: upgrade dep to test fibjs 0.37.0 (#62)
- Loading branch information
1 parent
03bd5ed
commit 7badb9b
Showing
5 changed files
with
195 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
vercomp () { | ||
if [[ $1 == $2 ]]; then | ||
export vercomp_last_result=0 | ||
return $vercomp_last_result | ||
fi | ||
local IFS=. | ||
local i ver1=($1) ver2=($2) | ||
# fill empty fields in ver1 with zeros | ||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) | ||
do | ||
ver1[i]=0 | ||
done | ||
for ((i=0; i<${#ver1[@]}; i++)) | ||
do | ||
if [[ -z ${ver2[i]} ]]; then | ||
# fill empty fields in ver2 with zeros | ||
ver2[i]=0 | ||
fi | ||
if ((10#${ver1[i]} > 10#${ver2[i]})); then | ||
export vercomp_last_result=1 | ||
return $vercomp_last_result | ||
fi | ||
if ((10#${ver1[i]} < 10#${ver2[i]})); then | ||
export vercomp_last_result=2 | ||
return $vercomp_last_result | ||
fi | ||
done | ||
export vercomp_last_result=0 | ||
return $vercomp_last_result | ||
} | ||
|
||
install_fibjs() { | ||
local version=$1 | ||
if [[ -z "$version" ]]; then | ||
echo "[install_fibjs] version is required" | ||
exit 1 | ||
fi | ||
local os=$2 | ||
if [[ -z "$os" ]]; then | ||
echo "[install_fibjs] os is required" | ||
exit 1 | ||
fi | ||
local arch=$3 | ||
if [[ -z "$arch" ]]; then | ||
echo "[install_fibjs] arch is required" | ||
exit 1 | ||
fi | ||
|
||
local url_base="https://github.com/fibjs/fibjs/releases/download/v${version}/fibjs-v${version}-${os}-${arch}" | ||
|
||
# in fact, there's also non-archived linux fibjs | ||
if [[ "$RUNNER_OS" == "Linux" ]]; then | ||
if [ "$lower_than_0_37_0" == "true" ]; then | ||
local remote_url="${url_base}.xz" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs.xz; | ||
xz -d ./node_modules/.bin/fibjs.xz; | ||
else | ||
local remote_url="${url_base}.tar.gz" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs.tar.gz; | ||
tar -xzf ./node_modules/.bin/fibjs.tar.gz -C ./node_modules/.bin; | ||
fi | ||
chmod a+x ./node_modules/.bin/fibjs; | ||
elif [[ "$RUNNER_OS" == "macOS" ]]; then | ||
local remote_url="${url_base}" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs; | ||
chmod a+x ./node_modules/.bin/fibjs; | ||
else | ||
local remote_url="${url_base}.exe" | ||
curl -SL "$remote_url" -o ./node_modules/.bin/fibjs.exe; | ||
fi | ||
echo "[install_fibjs] Downloading fibjs from ${remote_url}" | ||
} |
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
Oops, something went wrong.