From ca7105d8978ae3b9ed546ffaa3f7e1e96e456c2d Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Sun, 15 Mar 2026 21:52:49 +0000 Subject: [PATCH 1/3] ci: add installer.sh test automation Add a GitHub Actions workflow that tests installer.sh across distros: - Linux: Debian (apt), Ubuntu (apt), Fedora (yum), Alpine (apk), Debian (raw) - macOS: homebrew and raw methods Also add a local Docker-based test script (scripts/test/installer.sh) for quick iteration without pushing to CI. Tests run against published packages/releases. The installer script itself comes from the current commit so changes to it are tested even though the installed packages come from live repos. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/test-installer.yml | 88 ++++++++++++++++++++++++++++ scripts/test/installer.sh | 61 +++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 .github/workflows/test-installer.yml create mode 100755 scripts/test/installer.sh diff --git a/.github/workflows/test-installer.yml b/.github/workflows/test-installer.yml new file mode 100644 index 000000000..1f6425352 --- /dev/null +++ b/.github/workflows/test-installer.yml @@ -0,0 +1,88 @@ +name: Test installer.sh + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - installer.sh + pull_request: + paths: + - installer.sh + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + container: ${{ matrix.image }} + + strategy: + fail-fast: false + matrix: + include: + - image: debian:bookworm + method: apt + - image: ubuntu:24.04 + method: apt + - image: fedora:41 + method: yum + - image: alpine:3.21 + method: apk + - image: debian:bookworm + method: raw + + steps: + - name: Install prerequisites + run: | + case "${{ matrix.method }}" in + apt) + apt-get update && apt-get install -y curl ca-certificates + ;; + yum) + yum install -y curl + ;; + apk) + apk add --no-cache curl ca-certificates + ;; + raw) + apt-get update && apt-get install -y curl ca-certificates gzip + ;; + esac + + - name: Check out repository + uses: actions/checkout@v4 + + - name: Run installer + env: + INSTALL_METHOD: ${{ matrix.method }} + GITHUB_TOKEN: ${{ github.token }} + run: sh installer.sh + + - name: Verify installation + run: upsun --version + + macos: + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + method: + - homebrew + - raw + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Run installer + env: + INSTALL_METHOD: ${{ matrix.method }} + GITHUB_TOKEN: ${{ github.token }} + run: sh installer.sh + + - name: Verify installation + run: upsun --version diff --git a/scripts/test/installer.sh b/scripts/test/installer.sh new file mode 100755 index 000000000..fb7a4c777 --- /dev/null +++ b/scripts/test/installer.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# Test installer.sh across Linux distros using Docker. +# Requires Docker to be installed and running. + +set -eu + +cd "$(dirname "$0")/../.." + +pass=0 +fail=0 +errors="" + +run_test() { + image="$1" + method="$2" + prereqs="$3" + + label="${image} (${method})" + printf "Testing %-35s " "$label" + + if docker run --rm \ + -v "$(pwd)/installer.sh:/installer.sh:ro" \ + -e INSTALL_METHOD="$method" \ + "$image" \ + sh -c "${prereqs} sh /installer.sh && upsun --version" \ + >/dev/null 2>&1; then + printf "PASS\n" + pass=$((pass + 1)) + else + printf "FAIL\n" + fail=$((fail + 1)) + errors="${errors} ${label}\n" + fi +} + +echo "installer.sh test suite" +echo "=======================" +echo "" + +run_test "debian:bookworm" "apt" \ + "apt-get update && apt-get install -y curl ca-certificates && " + +run_test "ubuntu:24.04" "apt" \ + "apt-get update && apt-get install -y curl ca-certificates && " + +run_test "fedora:41" "yum" \ + "yum install -y curl && " + +run_test "alpine:3.21" "apk" \ + "apk add --no-cache curl ca-certificates && " + +run_test "debian:bookworm" "raw" \ + "apt-get update && apt-get install -y curl ca-certificates gzip && " + +echo "" +echo "Results: ${pass} passed, ${fail} failed" + +if [ "$fail" -gt 0 ]; then + printf "\nFailed:\n%b" "$errors" + exit 1 +fi From 4670fc22fc157fdcaca57da25a51bdad713e1e08 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Sun, 15 Mar 2026 21:55:22 +0000 Subject: [PATCH 2/3] fix(scripts): show Docker output in installer test script Show all Docker output (installer progress and errors) instead of suppressing it. Use -qq/-q flags on package managers to reduce noise from prerequisite installs while keeping installer output visible. Add a comment noting that macOS methods are CI-only. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/test/installer.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/test/installer.sh b/scripts/test/installer.sh index fb7a4c777..09bbab86d 100755 --- a/scripts/test/installer.sh +++ b/scripts/test/installer.sh @@ -1,6 +1,7 @@ #!/bin/sh # Test installer.sh across Linux distros using Docker. # Requires Docker to be installed and running. +# macOS methods (homebrew, raw) are only tested in CI (GitHub Actions). set -eu @@ -16,18 +17,18 @@ run_test() { prereqs="$3" label="${image} (${method})" - printf "Testing %-35s " "$label" + echo "" + echo "=== ${label} ===" if docker run --rm \ -v "$(pwd)/installer.sh:/installer.sh:ro" \ -e INSTALL_METHOD="$method" \ "$image" \ - sh -c "${prereqs} sh /installer.sh && upsun --version" \ - >/dev/null 2>&1; then - printf "PASS\n" + sh -c "${prereqs}sh /installer.sh && upsun --version"; then + echo "--- PASS: ${label} ---" pass=$((pass + 1)) else - printf "FAIL\n" + echo "--- FAIL: ${label} ---" fail=$((fail + 1)) errors="${errors} ${label}\n" fi @@ -35,24 +36,24 @@ run_test() { echo "installer.sh test suite" echo "=======================" -echo "" run_test "debian:bookworm" "apt" \ - "apt-get update && apt-get install -y curl ca-certificates && " + "apt-get update -qq && apt-get install -y -qq curl ca-certificates && " run_test "ubuntu:24.04" "apt" \ - "apt-get update && apt-get install -y curl ca-certificates && " + "apt-get update -qq && apt-get install -y -qq curl ca-certificates && " run_test "fedora:41" "yum" \ - "yum install -y curl && " + "yum install -y -q curl && " run_test "alpine:3.21" "apk" \ - "apk add --no-cache curl ca-certificates && " + "apk add -q --no-cache curl ca-certificates && " run_test "debian:bookworm" "raw" \ - "apt-get update && apt-get install -y curl ca-certificates gzip && " + "apt-get update -qq && apt-get install -y -qq curl ca-certificates gzip && " echo "" +echo "=======================" echo "Results: ${pass} passed, ${fail} failed" if [ "$fail" -gt 0 ]; then From 9f4fffc5ca8e96ae0e37ccbee9e71807d0570b19 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Sun, 15 Mar 2026 21:57:27 +0000 Subject: [PATCH 3/3] feat: add VERSION option to installer test script and workflow The raw install method needs /releases/latest on GitHub, which only returns non-prerelease versions. When only pre-releases exist, this fails. Allow passing a specific version to work around this. Local script: VERSION=5.0.4 scripts/test/installer.sh Workflow: workflow_dispatch input field Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/test-installer.yml | 7 +++++++ scripts/test/installer.sh | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/test-installer.yml b/.github/workflows/test-installer.yml index 1f6425352..03366dd9d 100644 --- a/.github/workflows/test-installer.yml +++ b/.github/workflows/test-installer.yml @@ -2,6 +2,11 @@ name: Test installer.sh on: workflow_dispatch: + inputs: + version: + description: 'CLI version to install (leave empty for latest release)' + required: false + type: string push: branches: - main @@ -59,6 +64,7 @@ jobs: env: INSTALL_METHOD: ${{ matrix.method }} GITHUB_TOKEN: ${{ github.token }} + VERSION: ${{ inputs.version }} run: sh installer.sh - name: Verify installation @@ -82,6 +88,7 @@ jobs: env: INSTALL_METHOD: ${{ matrix.method }} GITHUB_TOKEN: ${{ github.token }} + VERSION: ${{ inputs.version }} run: sh installer.sh - name: Verify installation diff --git a/scripts/test/installer.sh b/scripts/test/installer.sh index 09bbab86d..6d4e7801f 100755 --- a/scripts/test/installer.sh +++ b/scripts/test/installer.sh @@ -7,6 +7,8 @@ set -eu cd "$(dirname "$0")/../.." +: "${VERSION:=}" + pass=0 fail=0 errors="" @@ -20,9 +22,15 @@ run_test() { echo "" echo "=== ${label} ===" + version_flag="" + if [ -n "$VERSION" ]; then + version_flag="-e VERSION=$VERSION" + fi + if docker run --rm \ -v "$(pwd)/installer.sh:/installer.sh:ro" \ -e INSTALL_METHOD="$method" \ + $version_flag \ "$image" \ sh -c "${prereqs}sh /installer.sh && upsun --version"; then echo "--- PASS: ${label} ---"