Files
samios/.gitea/workflows/ci.yml
T
Sami Ahmed 5d735b2987
SamiOS CI / lint-and-test (push) Successful in 10s
[grade=C→fixing] Desktop overlay + build script + CI improvements
- packages.x86_64.desktop: 30+ packages for desktop variant (Plasma,
  Firefox, VLC, LibreOffice, PipeWire). No duplicates with base list.
- build-desktop.sh: creates temp profile, merges package lists, enables
  SDDM via preset + display-manager.service symlink. WORK_DIR is
  mktemp-created (not caller-selected) to prevent symlink races. VERSION
  copied into temp profile so profiledef.sh resolves correctly.
  Cleans up both temp dirs via trap.
- CI workflow: Python AST validation (sys.argv), VERSION SSOT gate,
  single make check (no double-lint).
- test_packages.sh: 15 assertions for desktop overlay (existence,
  package count, no dups, Plasma/Firefox exact match, build script
  structure: mktemp WORK_DIR, VERSION copy, SDDM, cleanup trap).

Codex D-grade findings fixed: symlink race (use mktemp), VERSION path
(../../VERSION not ../VERSION).
2026-08-12 03:41:50 -07:00

138 lines
5.0 KiB
YAML

name: SamiOS CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install shellcheck
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq shellcheck
- name: Install Make
run: |
if ! command -v make >/dev/null 2>&1; then
sudo apt-get install -y -qq make
fi
# ── Python AST validation ────────────────────────────────────────
- name: Validate Python syntax (AST parse)
run: |
set -e
while IFS= read -r -d '' f; do
echo "Checking $f..."
python3 -c "import ast, sys; ast.parse(open(sys.argv[1]).read())" "$f"
echo " ✓ $f"
done < <(find packaging/scripts -name '*.py' -print0)
# ── VERSION SSOT consistency ─────────────────────────────────────
- name: Verify VERSION single-source-of-truth
run: |
set -e
VERSION="$(cat VERSION)"
echo "Canonical VERSION: $VERSION"
# Mirror must match
MIRROR="$(head -n1 packaging/archiso/airootfs/etc/samios-version)"
if [ "$VERSION" != "$MIRROR" ]; then
echo "ERROR: VERSION ($VERSION) != airootfs mirror ($MIRROR)"
echo "Fix: make version-sync"
exit 1
fi
echo " ✓ airootfs mirror matches VERSION"
# PKGBUILD pkgver must resolve to VERSION (hyphen → underscore)
PKGVER="$(cd packaging/packages/samios-branding && source PKGBUILD >/dev/null 2>&1 && echo "$pkgver")"
EXPECTED_PKGVER="$(echo "$VERSION" | tr '-' '_')"
if [ "$PKGVER" != "$EXPECTED_PKGVER" ]; then
echo "ERROR: PKGBUILD pkgver ($PKGVER) != expected ($EXPECTED_PKGVER)"
exit 1
fi
echo " ✓ PKGBUILD pkgver resolves to VERSION"
echo ""
echo "VERSION SSOT consistency check PASSED ✓"
# ── Profile structure validation ─────────────────────────────────
- name: Validate archiso profile structure
run: |
set -e
PROFILE_DIR="packaging/archiso"
echo "Validating profile structure..."
# Required files
for f in profiledef.sh packages.x86_64 pacman.conf; do
if [ ! -f "$PROFILE_DIR/$f" ]; then
echo "ERROR: Missing required file: $PROFILE_DIR/$f"
exit 1
fi
echo " ✓ Found: $PROFILE_DIR/$f"
done
# profiledef.sh must have valid bash syntax
if ! bash -n "$PROFILE_DIR/profiledef.sh"; then
echo "ERROR: profiledef.sh has syntax errors"
exit 1
fi
echo " ✓ profiledef.sh syntax OK"
# packages.x86_64 must have at least one non-comment line
pkg_count=$(grep -vE '^\s*#|^\s*$' "$PROFILE_DIR/packages.x86_64" | wc -l)
if [ "$pkg_count" -lt 1 ]; then
echo "ERROR: packages.x86_64 has no packages listed"
exit 1
fi
echo " ✓ packages.x86_64 has $pkg_count package(s)"
# pacman.conf must have [options] and at least one repo section
if ! grep -q '\[options\]' "$PROFILE_DIR/pacman.conf"; then
echo "ERROR: pacman.conf missing [options] section"
exit 1
fi
if ! grep -qE '^\[(core|extra)\]' "$PROFILE_DIR/pacman.conf"; then
echo "ERROR: pacman.conf missing [core] or [extra] section"
exit 1
fi
echo " ✓ pacman.conf structure OK"
# Required airootfs files
for f in airootfs/usr/local/bin/samios; do
if [ ! -f "$PROFILE_DIR/$f" ]; then
echo "ERROR: Missing: $PROFILE_DIR/$f"
exit 1
fi
echo " ✓ Found: $PROFILE_DIR/$f"
done
# samios CLI must be executable
if [ ! -x "$PROFILE_DIR/airootfs/usr/local/bin/samios" ]; then
echo "ERROR: samios CLI is not executable"
exit 1
fi
echo " ✓ samios CLI is executable"
# Boot mode configs
for f in grub/grub.cfg syslinux/syslinux.cfg efiboot/loader/loader.conf; do
if [ ! -f "$PROFILE_DIR/$f" ]; then
echo "WARNING: Missing optional boot config: $PROFILE_DIR/$f"
else
echo " ✓ Found: $PROFILE_DIR/$f"
fi
done
echo ""
echo "Profile structure validation PASSED ✓"
# ── Test suite ───────────────────────────────────────────────────
- name: Run full test suite (lint + tests)
run: make check