Skip to content

Commit

Permalink
fix: install script on windows (#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
hdeadman authored Feb 8, 2023
1 parent 6a5b731 commit 68588b0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/test-install-osmatrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test install.sh

on:
pull_request:
paths:
- 'install.sh'
push:
branches:
- 'main'
- 'pr-*'

jobs:
test-install-script:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Run install.sh on ${{ matrix.os }}
shell: bash
# just run install.sh b/c github can throttle itself based on egress limits and gets 503 sometimes
run: |
echo "Simulating: curl -s https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_REF_NAME/install.sh | bash"
./install.sh
k3d version
- name: Create cluster
if: matrix.os == 'ubuntu-latest' # mac and windows Github runners can't use docker
run: k3d cluster create demo
13 changes: 12 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ initOS() {

case "$OS" in
# Minimalist GNU for Windows
mingw*) OS='windows';;
mingw*)
OS="windows"
USE_SUDO="false"
if [[ ! -d "$K3D_INSTALL_DIR" ]]; then
# mingw bash that ships with Git for Windows doesn't have /usr/local/bin but ~/bin is first entry in the path
mkdir -p ~/bin
K3D_INSTALL_DIR=~/bin
fi
;;
esac
}

Expand Down Expand Up @@ -107,6 +115,9 @@ checkLatestVersion() {
downloadFile() {
K3D_DIST="k3d-$OS-$ARCH"
DOWNLOAD_URL="$REPO_URL/releases/download/$TAG/$K3D_DIST"
if [[ "$OS" == "windows" ]]; then
DOWNLOAD_URL=${DOWNLOAD_URL}.exe
fi
K3D_TMP_ROOT="$(mktemp -dt k3d-binary-XXXXXX)"
K3D_TMP_FILE="$K3D_TMP_ROOT/$K3D_DIST"
if type "curl" > /dev/null; then
Expand Down

0 comments on commit 68588b0

Please sign in to comment.