-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add windows support to ci_setup/setup script. #22259
Changes from 1 commit
c80fc25
f163d52
c8bcf32
efea0fc
6f1bdf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,26 @@ fi | |
### | ||
### download node | ||
### | ||
UNAME=`uname` | ||
OS='linux' | ||
if [[ "$UNAME" = *"MINGW64_NT"* ]]; then | ||
OS='win' | ||
fi | ||
echo "Running on OS: $OS" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mind throwing |
||
|
||
nodeVersion="$(cat $dir/.node-version)" | ||
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.gz" | ||
nodeDir="$cacheDir/node/$nodeVersion" | ||
nodeBin="$nodeDir/bin" | ||
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.gz" | ||
if [[ $OS == 'win' ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we if/else this like we're doing on line 62? |
||
nodeBin="$nodeDir" | ||
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-win-x64.zip" | ||
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 | ||
|
@@ -46,14 +59,25 @@ 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" | ||
if [[ $OS == 'win' ]]; then | ||
export PATH="$PATH:$nodeBin" | ||
else | ||
export PATH="$nodeBin:$PATH" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we prepend, vs append on Linux? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was getting node path errors if the node bin dir it was not listed at the end of the windows path There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not seeing any errors with setting it first - if anything I would expect an issue if there was a node executable already in your path. Setting it first would give it precedence. What is the exact error you're seeing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why :) It was this type of error: It is possible I had another node version installed when the problem occurred, I can't recall right now. I will remove it for now and if the problem comes up again we can fix it at that time. |
||
fi | ||
hash -r | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we stick with the
"$(uname)"
syntax? Shellcheck recommends it, and I assume for a good reason.