etherpad-lite/.github/workflows/installer-test.yml
dependabot[bot] acba429e1a
build(deps): bump actions/checkout from 6 to 7 (#7977)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-19 12:47:45 +01:00

180 lines
6.9 KiB
YAML

name: "Installer test"
# Exercises bin/installer.sh and bin/installer.ps1 end-to-end so the
# one-line install paths in the README stay working.
on:
push:
paths:
- "bin/installer.sh"
- "bin/installer.ps1"
- ".github/workflows/installer-test.yml"
pull_request:
paths:
- "bin/installer.sh"
- "bin/installer.ps1"
- ".github/workflows/installer-test.yml"
permissions:
contents: read
jobs:
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Run shellcheck on installer.sh
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
shellcheck bin/installer.sh
installer-posix:
name: end-to-end install (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Pre-install pnpm (avoid sudo prompt in the installer)
run: npm install -g pnpm
- name: Run bin/installer.sh against this commit
env:
ETHERPAD_DIR: ${{ runner.temp }}/etherpad-installer-test
ETHERPAD_REPO: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.clone_url || format('{0}/{1}.git', github.server_url, github.repository) }}
ETHERPAD_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
NO_COLOR: "1"
run: sh ./bin/installer.sh
- name: Verify clone + dependencies + build artifacts
shell: bash
env:
ETHERPAD_DIR: ${{ runner.temp }}/etherpad-installer-test
run: |
set -eux
test -d "$ETHERPAD_DIR/.git"
test -f "$ETHERPAD_DIR/package.json"
test -d "$ETHERPAD_DIR/node_modules"
test -d "$ETHERPAD_DIR/src/node_modules"
# build:etherpad copies the admin SPA into src/templates/admin
test -f "$ETHERPAD_DIR/src/templates/admin/index.html"
- name: Smoke test - start Etherpad and curl /api
shell: bash
# Hard backstop: if teardown ever fails to reap the server the step
# fails in minutes instead of burning to GitHub's 6h job ceiling.
timeout-minutes: 8
env:
ETHERPAD_DIR: ${{ runner.temp }}/etherpad-installer-test
run: |
set -eu
# Enable job control so the backgrounded launcher gets its own
# process group, letting us reap the whole pnpm -> node tree below.
set -m
cd "$ETHERPAD_DIR"
pnpm run prod >/tmp/etherpad.log 2>&1 &
PID=$!
# `pnpm run prod` is a nested launcher (pnpm -> pnpm --filter -> node),
# so killing $PID alone orphans the node server, which keeps the step's
# output pipe open and hangs CI. Kill the entire process group, with a
# SIGKILL fallback in case SIGTERM is swallowed (e.g. a live flush timer
# keeping the event loop alive), so the step always exits cleanly.
reap() {
kill -TERM "-$PID" 2>/dev/null || true
sleep 5
kill -KILL "-$PID" 2>/dev/null || true
}
trap reap EXIT
# Wait up to 60s for the API to come up.
ok=0
for i in $(seq 1 60); do
if curl -fsS http://localhost:9001/api >/dev/null 2>&1; then
echo "Etherpad answered on /api after ${i}s"
ok=1
break
fi
sleep 1
done
if [ "$ok" != "1" ]; then
echo "Etherpad did not start within 60s. Last 200 lines of log:" >&2
tail -200 /tmp/etherpad.log >&2 || true
exit 1
fi
installer-windows:
name: end-to-end install (windows-latest)
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Pre-install pnpm
run: npm install -g pnpm
- name: Run bin/installer.ps1 against this commit
shell: pwsh
env:
ETHERPAD_DIR: ${{ runner.temp }}\etherpad-installer-test
ETHERPAD_REPO: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.clone_url || format('{0}/{1}.git', github.server_url, github.repository) }}
ETHERPAD_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
NO_COLOR: "1"
run: ./bin/installer.ps1
- name: Verify clone + dependencies + build artifacts
shell: pwsh
env:
ETHERPAD_DIR: ${{ runner.temp }}\etherpad-installer-test
run: |
if (-not (Test-Path "$env:ETHERPAD_DIR\.git")) { throw '.git missing' }
if (-not (Test-Path "$env:ETHERPAD_DIR\package.json")) { throw 'package.json missing' }
if (-not (Test-Path "$env:ETHERPAD_DIR\node_modules")) { throw 'node_modules missing' }
if (-not (Test-Path "$env:ETHERPAD_DIR\src\node_modules")) { throw 'src/node_modules missing' }
if (-not (Test-Path "$env:ETHERPAD_DIR\src\templates\admin\index.html")) { throw 'admin SPA missing' }
- name: Smoke test - start Etherpad and curl /api
shell: pwsh
timeout-minutes: 8
env:
ETHERPAD_DIR: ${{ runner.temp }}\etherpad-installer-test
run: |
Push-Location $env:ETHERPAD_DIR
$logPath = Join-Path $env:RUNNER_TEMP 'etherpad.log'
# pnpm on Windows is a .cmd shim, which Start-Process can't run
# directly — wrap it in cmd.exe.
$proc = Start-Process -FilePath cmd.exe `
-ArgumentList '/c','pnpm','run','prod' `
-RedirectStandardOutput $logPath `
-RedirectStandardError "$logPath.err" `
-PassThru -NoNewWindow
$ok = $false
for ($i = 1; $i -le 90; $i++) {
try {
Invoke-WebRequest -UseBasicParsing -Uri http://localhost:9001/api -TimeoutSec 2 | Out-Null
Write-Host "Etherpad answered on /api after ${i}s"
$ok = $true
break
} catch { Start-Sleep -Seconds 1 }
}
if (-not $ok) {
Write-Host 'Etherpad did not start within 90s. Last 200 lines of log (stdout):'
if (Test-Path $logPath) { Get-Content $logPath -Tail 200 }
Write-Host 'Last 200 lines of stderr:'
if (Test-Path "$logPath.err") { Get-Content "$logPath.err" -Tail 200 }
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
Pop-Location
exit 1
}
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
Pop-Location