/ .forgejo / workflows / ci.yml
ci.yml
  1  name: Frontend CI
  2  
  3  on:
  4    push:
  5      branches: [main]
  6    pull_request:
  7      branches: [main]
  8  
  9  env:
 10    NODE_VERSION: '20'
 11    PATH: /home/devops/.local/bin:/usr/local/bin:/usr/bin:/bin
 12  
 13  jobs:
 14    ci:
 15      name: Full CI (lint, typecheck, audit, test, build)
 16      runs-on: native
 17      steps:
 18        - name: Checkout
 19          uses: actions/checkout@v4
 20  
 21        - name: Setup Node.js
 22          uses: actions/setup-node@v4
 23          with:
 24            node-version: ${{ env.NODE_VERSION }}
 25  
 26        - name: Run Full CI
 27          run: just ci-full
 28  
 29    coverage:
 30      name: Code Coverage
 31      runs-on: native
 32      needs: ci
 33      continue-on-error: true
 34      steps:
 35        - name: Checkout
 36          uses: actions/checkout@v4
 37  
 38        - name: Setup Node.js
 39          uses: actions/setup-node@v4
 40          with:
 41            node-version: ${{ env.NODE_VERSION }}
 42  
 43        - name: Install & Coverage
 44          run: |
 45            just install
 46            just coverage
 47  
 48        - name: Upload Coverage
 49          uses: actions/upload-artifact@v4
 50          with:
 51            name: coverage-report
 52            path: coverage/
 53            retention-days: 30
 54  
 55    sbom:
 56      name: Generate SBOM
 57      runs-on: native
 58      needs: ci
 59      if: github.ref == 'refs/heads/main'
 60      continue-on-error: true
 61      steps:
 62        - name: Checkout
 63          uses: actions/checkout@v4
 64  
 65        - name: Setup Node.js
 66          uses: actions/setup-node@v4
 67          with:
 68            node-version: ${{ env.NODE_VERSION }}
 69  
 70        - name: Generate SBOM
 71          run: |
 72            just install
 73            just sbom
 74  
 75        - name: Upload SBOM
 76          uses: actions/upload-artifact@v4
 77          with:
 78            name: sbom
 79            path: sbom.json
 80            retention-days: 90
 81  
 82    radicle-sync:
 83      name: Radicle Sync
 84      runs-on: native
 85      needs: ci
 86      if: github.ref == 'refs/heads/main' && github.event_name == 'push'
 87      continue-on-error: true
 88      steps:
 89        - name: Checkout
 90          uses: actions/checkout@v4
 91          with:
 92            fetch-depth: 0
 93            path: forgejo-src
 94  
 95        - name: Sync to Radicle
 96          run: |
 97            export PATH=$HOME/.radicle/bin:$PATH
 98            RID="rad:zBYpyrBkSbQEf6sQ8YhxwkuJr6ni"
 99            rm -rf radicle-repo
100            NODE_ID=$(rad self --nid 2>/dev/null || echo "")
101            [ -z "$NODE_ID" ] && echo "Radicle not configured" && exit 0
102            rad clone "$RID" radicle-repo 2>/dev/null || { mkdir -p radicle-repo && cd radicle-repo && git init && git remote add rad "rad://${RID#rad:}/${NODE_ID}" && git remote add forgejo ../forgejo-src && git fetch forgejo main && git checkout -b main forgejo/main && git push rad main; exit 0; }
103            cd radicle-repo && git remote add forgejo ../forgejo-src 2>/dev/null || true
104            git fetch forgejo main && git reset --hard forgejo/main && git push rad main || echo "Sync complete"