Files
CyberPanel/.github/workflows/ci.yml
master3395 e741dfba11 CI: skip validate-python when versionFetcher.py missing; do not require it in key files
- stable branch has no plogical/versionFetcher.py; CI #23 failed on smoke-key-files and validate-python
- validate-python: run only if hashFiles('plogical/versionFetcher.py') != ''
- smoke-key-files and validate-on-os: require only preUpgrade, loader, upgrade.py, install.py; versionFetcher optional
2026-02-15 19:50:50 +01:00

155 lines
6.4 KiB
YAML

# Lightweight CI for v2.5.5-dev (free for public repos).
# Validates shell syntax, Python version fetcher, and key files on all supported OSes via Docker.
# CloudLinux and RHEL use Rocky/Alma images as proxies (same family, no official Docker images).
name: CI
on:
push:
branches: [v2.5.5-dev, stable, master]
pull_request:
branches: [v2.5.5-dev, stable, master]
jobs:
validate-shell:
name: Validate shell scripts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Syntax check shell scripts
run: |
for f in cyberpanel_upgrade.sh preUpgrade.sh fix-phpmyadmin.sh cyberpanel.sh cyberpanel_utility.sh; do
[ ! -f "$f" ] && continue
bash -n "$f" || { echo "FAIL (syntax): $f"; exit 1; }
echo "OK $f"
done
test -f preUpgrade.sh && test -f cyberpanel_upgrade.sh || { echo "Missing required scripts"; exit 1; }
if [ -d upgrade_modules ]; then
echo "=== Upgrade modules syntax ==="
for f in upgrade_modules/*.sh; do
[ -f "$f" ] || continue
bash -n "$f" || { echo "FAIL (syntax): $f"; exit 1; }
echo "OK $f"
done
fi
echo "All shell scripts passed syntax check"
validate-python:
name: Validate Python (version fetcher)
runs-on: ubuntu-latest
if: hashFiles('plogical/versionFetcher.py') != ''
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requests
run: pip install requests
- name: Run version fetcher (phpMyAdmin / SnappyMail)
run: |
PYTHONPATH=. python3 -c "
from plogical.versionFetcher import get_latest_phpmyadmin_version, get_latest_snappymail_version
pma = get_latest_phpmyadmin_version()
snappy = get_latest_snappymail_version()
assert pma and len(pma) >= 5, 'phpMyAdmin version invalid'
assert snappy and len(snappy) >= 3, 'SnappyMail version invalid'
print('phpMyAdmin:', pma, 'SnappyMail:', snappy)
"
smoke-key-files:
name: Key files present
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check key install/upgrade files exist
run: |
for f in preUpgrade.sh cyberpanel_upgrade.sh plogical/upgrade.py install/install.py; do
test -f "$f" || { echo "Missing: $f"; exit 1; }
done
test -f plogical/versionFetcher.py && echo "versionFetcher.py present" || echo "versionFetcher.py optional (not on all branches)"
grep -q 'BRANCH_NAME' preUpgrade.sh || exit 1
if [ -d upgrade_modules ]; then
for n in 00_common 01_variables 02_checks 03_mariadb 04_git_url 05_repository 06_components 07_branch_input 08_main_upgrade 09_sync 10_post_tweak 11_display_final; do
test -f "upgrade_modules/${n}.sh" || { echo "Missing: upgrade_modules/${n}.sh"; exit 1; }
done
grep -q 'Branch_Check\|Branch_Name' upgrade_modules/00_common.sh upgrade_modules/02_checks.sh || exit 1
grep -q 'upgrade_modules\|Pre_Upgrade_Branch_Input\|Set_Default_Variables' cyberpanel_upgrade.sh || exit 1
else
grep -q 'Branch_Name\|download_install_phpmyadmin\|Branch_Check' cyberpanel_upgrade.sh || exit 1
fi
echo "Key files OK"
# Run validation inside a container per supported OS (AlmaLinux, CentOS, CloudLinux, Debian, RHEL, Rocky, Ubuntu).
validate-on-os:
name: Validate on ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: AlmaLinux 8
image: almalinux:8
- os: AlmaLinux 9
image: almalinux:9
- os: AlmaLinux 10
image: almalinux:10
- os: CentOS 7
image: centos:7
- os: CloudLinux 8
image: rockylinux:8
- os: CloudLinux 9
image: rockylinux:9
- os: Debian 11
image: debian:11
- os: Debian 12
image: debian:12
- os: Debian 13
image: debian:13
- os: RHEL 8
image: almalinux:8
- os: RHEL 9
image: almalinux:9
- os: RockyLinux 8
image: rockylinux:8
- os: RockyLinux 9
image: rockylinux:9
- os: Ubuntu 20.04
image: ubuntu:20.04
- os: Ubuntu 22.04
image: ubuntu:22.04
- os: Ubuntu 24.04
image: ubuntu:24.04
steps:
- uses: actions/checkout@v4
- name: Validate on ${{ matrix.os }} (${{ matrix.image }})
run: |
docker run --rm \
-v "$PWD:/repo:ro" \
-w /repo \
"${{ matrix.image }}" \
bash -c '
set -e
echo "=== Shell syntax check ==="
for f in cyberpanel_upgrade.sh preUpgrade.sh fix-phpmyadmin.sh cyberpanel.sh cyberpanel_utility.sh; do
[ ! -f "$f" ] && continue
bash -n "$f" || { echo "FAIL (syntax): $f"; exit 1; }
echo "OK $f"
done
test -f preUpgrade.sh && test -f cyberpanel_upgrade.sh || { echo "Missing required scripts"; exit 1; }
echo "=== Key files ==="
for f in preUpgrade.sh cyberpanel_upgrade.sh plogical/upgrade.py install/install.py; do
test -f "$f" || { echo "Missing: $f"; exit 1; }
done
grep -q "BRANCH_NAME" preUpgrade.sh || exit 1
if [ -d upgrade_modules ]; then
for n in 00_common 01_variables 02_checks 03_mariadb 04_git_url 05_repository 06_components 07_branch_input 08_main_upgrade 09_sync 10_post_tweak 11_display_final; do
test -f "upgrade_modules/${n}.sh" || { echo "Missing: upgrade_modules/${n}.sh"; exit 1; }
done
grep -q "Branch_Check\|Branch_Name" upgrade_modules/00_common.sh upgrade_modules/02_checks.sh || exit 1
grep -q "upgrade_modules\|Pre_Upgrade_Branch_Input\|Set_Default_Variables" cyberpanel_upgrade.sh || exit 1
for f in upgrade_modules/*.sh; do [ -f "$f" ] && bash -n "$f" || exit 1; done
else
grep -q "Branch_Name\|download_install_phpmyadmin\|Branch_Check" cyberpanel_upgrade.sh || exit 1
fi
echo "Done."
'