mirror of
https://github.com/TimInTech/proxmox-manager.git
synced 2026-11-25 04:44:19 +03:00
139 lines
4.8 KiB
YAML
139 lines
4.8 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
shellcheck:
|
|
name: Shell checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install shellcheck
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y shellcheck
|
|
|
|
- name: Run shellcheck
|
|
run: |
|
|
set -euo pipefail
|
|
mapfile -d '' -t files < <(find . -maxdepth 4 -type f -name '*.sh' -print0)
|
|
if [ ${#files[@]} -eq 0 ]; then
|
|
echo "No shell scripts found."
|
|
exit 0
|
|
fi
|
|
for file in "${files[@]}" maintenance/pman-maintenance; do
|
|
bash -n "$file"
|
|
done
|
|
shellcheck -x "${files[@]}" maintenance/pman-maintenance
|
|
|
|
- name: Download, verify, and run shfmt
|
|
env:
|
|
SHFMT_VERSION: 3.13.1
|
|
SHFMT_SHA256: fb096c5d1ac6beabbdbaa2874d025badb03ee07929f0c9ff67563ce8c75398b1
|
|
run: |
|
|
set -euo pipefail
|
|
shfmt_path="${RUNNER_TEMP}/shfmt"
|
|
curl --fail --location --silent --show-error \
|
|
--proto '=https' --tlsv1.2 \
|
|
--retry 3 \
|
|
"https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" \
|
|
--output "${shfmt_path}"
|
|
printf '%s %s\n' "${SHFMT_SHA256}" "${shfmt_path}" | sha256sum --check --strict
|
|
chmod 0755 "${shfmt_path}"
|
|
"${shfmt_path}" -d proxmox-manager.sh install_dependencies.sh maintenance/pman-maintenance tools/build-release.sh
|
|
|
|
- name: Run tests
|
|
run: |
|
|
set -euo pipefail
|
|
bash tests/run.sh
|
|
bash tests/test_inventory.sh
|
|
bash tests/test_spice.sh
|
|
|
|
maintenance:
|
|
name: Maintenance Python ${{ matrix.python }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python: ['3.9', '3.13']
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
- name: Native adapter, source-check and installer tests
|
|
run: python3 -B -m unittest discover -s tests/maintenance -v
|
|
- name: Build and verify release bundle
|
|
run: |
|
|
bash tools/build-release.sh dist
|
|
cd dist
|
|
sha256sum -c SHA256SUMS
|
|
|
|
website:
|
|
name: Documentation site
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: '24'
|
|
cache: npm
|
|
cache-dependency-path: site/package-lock.json
|
|
- name: Install dependencies
|
|
working-directory: site
|
|
run: npm ci
|
|
- name: Build site
|
|
working-directory: site
|
|
run: npm run build
|
|
- name: Verify build output
|
|
run: |
|
|
set -euo pipefail
|
|
python3 - <<'PY'
|
|
import html
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
dist = Path('site/dist')
|
|
pages = sorted(dist.rglob('*.html'))
|
|
expected = {'index.html', 'anleitung/index.html', 'health/index.html',
|
|
'wartung/index.html', 'datenschutz/index.html'}
|
|
found = {p.relative_to(dist).as_posix() for p in pages}
|
|
missing = expected - found
|
|
if missing:
|
|
sys.exit(f'missing pages in build: {sorted(missing)}')
|
|
for page in pages:
|
|
text = html.unescape(page.read_text(encoding='utf-8'))
|
|
if '[PLATZHALTER]' in text:
|
|
sys.exit(f'placeholder left in {page}')
|
|
guide = html.unescape((dist / 'anleitung' / 'index.html').read_text(encoding='utf-8'))
|
|
for needle in ('HEALTH_CPU_RUNS', 'cat >/etc/cron.d/pman-health', '--filter running'):
|
|
if needle not in guide:
|
|
sys.exit(f'guide lost command: {needle}')
|
|
for anchor in ('id="installation"', 'id="health-monitoring--alerts"',
|
|
'id="relaying-through-an-external-smtp-provider"'):
|
|
if anchor not in guide:
|
|
sys.exit(f'guide lost anchor: {anchor}')
|
|
if 'CHANGELOG.md)' in guide:
|
|
sys.exit('guide still links CHANGELOG.md relatively')
|
|
print(f'{len(pages)} pages verified')
|
|
PY
|
|
- name: Audit dependencies
|
|
working-directory: site
|
|
run: npm audit --omit=dev
|