Skip to content

Commit

Permalink
Add windows support to ci_setup/setup script. (#22259) (#22565)
Browse files Browse the repository at this point in the history
* Add windows support to ci_setup/setup script.

* Update uname syntax

* Update echo statement to match rest

* Update if statement for node package

* Revert path variable
  • Loading branch information
liza-mae authored Aug 31, 2018
1 parent 5307703 commit f166525
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,27 @@ fi
###
### download node
###
UNAME=$(uname)
OS='linux'
if [[ "$UNAME" = *"MINGW64_NT"* ]]; then
OS='win'
fi
echo " -- Running on OS: $OS"

nodeVersion="$(cat $dir/.node-version)"
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.gz"
nodeDir="$cacheDir/node/$nodeVersion"
if [[ $OS == 'win' ]]; then
nodeBin="$nodeDir"
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-win-x64.zip"
else
nodeBin="$nodeDir/bin"
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.gz"
fi

echo " -- node: version=v${nodeVersion} dir=$nodeDir"

echo " -- setting up node.js"
if [ -x "$nodeDir/bin/node" ] && [ "$($nodeDir/bin/node --version)" == "v$nodeVersion" ]; then
if [ -x "$nodeBin/node" ] && [ "$($nodeBin/node --version)" == "v$nodeVersion" ]; then
echo " -- reusing node.js install"
else
if [ -d "$nodeDir" ]; then
Expand All @@ -46,14 +60,21 @@ else

echo " -- downloading node.js from $nodeUrl"
mkdir -p "$nodeDir"
curl --silent "$nodeUrl" | tar -xz -C "$nodeDir" --strip-components=1
if [[ $OS == 'win' ]]; then
nodePkg="$nodeDir/${nodeUrl##*/}"
curl --silent -o $nodePkg $nodeUrl
unzip -jqo $nodePkg -d $nodeDir
else
curl --silent "$nodeUrl" | tar -xz -C "$nodeDir" --strip-components=1
fi

fi


###
### "install" node into this shell
###
export PATH="$nodeDir/bin:$PATH"
export PATH="$nodeBin:$PATH"
hash -r


Expand Down

0 comments on commit f166525

Please sign in to comment.