Skip to content

Commit

Permalink
ci: add installation test for OS and arch
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBeucher committed Jul 30, 2024
1 parent e29ff95 commit ec17a17
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test installation script

on:
push:
branches:
- "*"
pull_request:
branches:
- master

jobs:
test-install:
name: Test install.sh
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-20.04
# - macos-14 # Docker install suported yet
- macos-13
- macos-12
# arch:
# - x64
# - arm64

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: (MacOS) Setup Docker
if: startsWith(matrix.os, 'macos')
# uses: docker-practice/actions-setup-docker@master
# timeout-minutes: 12
uses: douglascamata/setup-docker-macos-action@master

# Test the install script and cloudypad.sh for current commit
- name: Run install script
run: |
curl -fsSL https://raw.githubusercontent.com/PierreBeucher/cloudypad/${{ github.sha }}/install.sh | CLOUDYPAD_VERSION=${{ github.sha }} sh
- name: Check version
run: |
export PATH=$PATH:/home/runner/.cloudypad/bin
export CLOUDYPAD_CONTAINER_NO_TTY=true
cloudypad --version
10 changes: 9 additions & 1 deletion cloudypad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ run_cloudypad_docker() {
)

# Build run command with proper directories
local cmd="docker run --rm -it"
local cmd="docker run --rm"

# Set interactive+tty by default
# no tty if CLOUDYPAD_CONTAINER_NO_TTY is set (for CI)
if [ -n "$CLOUDYPAD_CONTAINER_NO_TTY" ]; then
cmd="$cmd -t"
else
cmd="$cmd -it"
fi

# Only mount a directory if it exists on host
for mount in "${mounts[@]}"; do
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ if [ -n "$(which cloudypad)" ]; then
fi
fi

echo "Downloading Cloudy Pad CLI..."

# Create secure directory for Cloudy Pad home as it may contain sensitive data
mkdir -p "$CLOUDYPAD_HOME"
chmod 0700 $CLOUDYPAD_HOME

mkdir -p "$INSTALL_DIR"

echo "Downloading $CLOUDYPAD_SCRIPT_URL..."

if command -v curl >/dev/null 2>&1; then
curl --fail -sSL -o "$SCRIPT_PATH" "$CLOUDYPAD_SCRIPT_URL"
elif command -v wget >/dev/null 2>&1; then
Expand Down

0 comments on commit ec17a17

Please sign in to comment.