ci.yml
1 name: CI 2 3 concurrency: 4 group: ci-${{ github.ref }} 5 cancel-in-progress: true 6 7 on: 8 push: 9 branches: [main] 10 pull_request: 11 branches: [main] 12 13 jobs: 14 lint: 15 runs-on: native 16 steps: 17 - name: Checkout 18 uses: actions/checkout@v4 19 20 - name: Check Python syntax 21 run: | 22 python3 -m py_compile backend/main.py 23 python3 -m py_compile backend/ci-watcher.py 24 25 - name: Check for common issues 26 run: | 27 for f in backend/*.py; do 28 python3 -c "import ast; ast.parse(open('$f').read())" || exit 1 29 done 30 31 deploy: 32 runs-on: native 33 needs: lint 34 if: github.ref == 'refs/heads/main' && github.event_name == 'push' 35 steps: 36 - name: Deploy to source server 37 run: | 38 ssh -p 2584 -o BatchMode=yes -o StrictHostKeyChecking=accept-new devops@source.ac-dc.network << 'DEPLOY' 39 cd /home/devops/ci-dashboard 40 git fetch origin main 41 git reset --hard origin/main 42 # Restart backend if running as systemd service 43 if systemctl is-active --quiet ci-dashboard; then 44 sudo systemctl restart ci-dashboard 45 echo "Backend service restarted" 46 else 47 echo "No systemd service, backend will pick up changes on next request" 48 fi 49 echo "Deploy complete: $(git rev-parse --short HEAD)" 50 DEPLOY 51 52 sync-to-radicle: 53 runs-on: native 54 needs: [lint, deploy] 55 if: github.ref == 'refs/heads/main' && github.event_name == 'push' 56 steps: 57 - name: Checkout from Forgejo 58 uses: actions/checkout@v4 59 with: 60 fetch-depth: 0 61 path: forgejo-src 62 63 - name: Sync to Radicle 64 run: | 65 export PATH=$HOME/.radicle/bin:$PATH 66 RID="rad:z2rtnhcewMCLzngSVTUT3xshZsDbt" 67 68 rad clone "$RID" radicle-repo || true 69 cd radicle-repo 70 71 git remote add forgejo ../forgejo-src || git remote set-url forgejo ../forgejo-src 72 git fetch forgejo main 73 74 git checkout main 75 git merge --ff-only forgejo/main || git reset --hard forgejo/main 76 77 git push rad main