Skip to content

fix(windows): add UTF-8 BOM to PowerShell scripts #75

fix(windows): add UTF-8 BOM to PowerShell scripts

fix(windows): add UTF-8 BOM to PowerShell scripts #75

Workflow file for this run

name: Lint & Test
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
shfmt:
name: Shell Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shfmt
shell: bash
run: |
set -euo pipefail
curl -sSL "https://github.com/mvdan/sh/releases/download/v3.8.0/shfmt_v3.8.0_linux_amd64" -o /tmp/shfmt
echo "27b3c6f9d9592fc5b4856c341d1ff2c88856709b9e76469313642a1d7b558fe0 /tmp/shfmt" | sha256sum -c - || { echo "shfmt checksum mismatch — update the fixed checksum"; exit 1; }
sudo install -m 755 /tmp/shfmt /usr/local/bin/shfmt
shfmt --version
- name: Check formatting
run: shfmt -d -i 4 -ci setup.sh uninstall.sh tests/
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ShellCheck
run: sudo apt-get update && sudo apt-get install -y shellcheck
- name: Lint setup.sh
run: shellcheck setup.sh
- name: Lint uninstall.sh
run: shellcheck uninstall.sh
- name: Lint tests
run: shellcheck tests/*.sh
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run API key tests
run: bash tests/test_api_key.sh
- name: Run setup function tests
run: bash tests/test_setup_functions.sh
- name: Extract and validate manage.sh
run: |
# Extract the heredoc content that generates manage.sh from setup.sh.
# Track heredoc delimiters per opening `cat ... manage.sh <<'TAG'` line so
# that nested heredocs (or same-named delimiters in a single file) are
# captured correctly. Strip the cat/EOF wrapper lines from the output.
awk '
/^[[:space:]]*cat >+"\${INSTALL_DIR}\/manage.sh" <</ {
match($0, /<<'\''(MANAGE_[A-Z_]+)'\''$/, m)
tag = m[1]
print "### " NR ": " $0
capturing = 1
next
}
capturing && $0 == tag {
print "### " NR ": " $0
capturing = 0
tag = ""
next
}
capturing { print }
' setup.sh > /tmp/manage_extracted.sh
if [[ ! -s /tmp/manage_extracted.sh ]]; then
echo "::error::manage.sh extraction failed: no content captured from setup.sh heredocs"
exit 1
fi
bash -n /tmp/manage_extracted.sh && echo "manage.sh syntax OK" || {
echo "::error::manage.sh has syntax errors"
exit 1
}
- name: Validate uninstall.sh syntax
run: bash -n uninstall.sh && echo "uninstall.sh syntax OK"
- name: Validate setup.sh syntax
run: bash -n setup.sh && echo "setup.sh syntax OK"
- name: Validate docker-compose.yml
run: |
# Validate compose template with representative environment variables
export PUID=1000
export PGID=1000
export TZ=UTC
export CONFIG_DIR=/tmp/config
export DATA_DIR=/tmp/data
export MOUNT_DIR=/tmp/mount
export TORBOX_API_KEY=testkey1234567890123456789012345
export RADARR_API_KEY=radarrkey12345678901234567890123
export SONARR_API_KEY=sonarrkey12345678901234567890123
export PROWLARR_API_KEY=prowlarrkey1234567890123456789012
export DECYPHARR_USER=torbox
export DECYPHARR_PASS=password
export PLEX_CLAIM=claim-xxxxx
docker compose config -q