name: ci
on:
  push:
    branches: [main, master]
  pull_request: {}
  workflow_dispatch: {}

# We run a Linux runner; macOS xcodebuild is not available here.
# This workflow validates structure (yaml, file presence) and basic Swift.
jobs:
  validate:
    runs-on: cxai-hostinger
    container: debian:bookworm
    steps:
      - name: Install deps
        run: |
          apt-get update -qq
          apt-get install -y --no-install-recommends git ca-certificates curl python3-yaml >/dev/null
      - uses: actions/checkout@v4
      - name: Lint workflow YAML
        run: |
          python3 - <<'PY'
          import sys, yaml, glob
          for f in glob.glob('.gitea/workflows/*.yml') + glob.glob('.github/workflows/*.yml'):
              try:
                  yaml.safe_load(open(f))
              except Exception as e:
                  print(f'YAML ERROR {f}: {e}'); sys.exit(1)
          print('workflows ok')
          PY
      - name: Project sanity
        run: |
          test -f README.md || (echo "missing README" && exit 1)
          test -f Makefile  || (echo "missing Makefile" && exit 1)
          ls *.xcodeproj  >/dev/null 2>&1 && echo "xcodeproj: $(ls -d *.xcodeproj)" || true
          [ -f Package.swift ] && echo "Package.swift present" || true
