Skip to content
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

fix: install script on windows #1168

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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