|
| 1 | +name: CI Extended (RSR Compliance) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop, claude/**] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
| 8 | + schedule: |
| 9 | + - cron: '0 0 * * 0' # Weekly on Sunday |
| 10 | + |
| 11 | +jobs: |
| 12 | + rsr-compliance: |
| 13 | + name: RSR Framework Verification |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup Deno |
| 19 | + uses: denoland/setup-deno@v1 |
| 20 | + with: |
| 21 | + deno-version: v1.x |
| 22 | + |
| 23 | + - name: Check RSR Compliance |
| 24 | + run: deno run --allow-read scripts/rsr-score.ts |
| 25 | + |
| 26 | + - name: Verify Required Files |
| 27 | + run: | |
| 28 | + files=( |
| 29 | + "SECURITY.md" |
| 30 | + "CODE_OF_CONDUCT.md" |
| 31 | + "MAINTAINERS.md" |
| 32 | + ".well-known/security.txt" |
| 33 | + ".well-known/ai.txt" |
| 34 | + ".well-known/humans.txt" |
| 35 | + "PALIMPSEST-LICENSE.txt" |
| 36 | + ) |
| 37 | +
|
| 38 | + for file in "${files[@]}"; do |
| 39 | + if [ ! -f "$file" ]; then |
| 40 | + echo "❌ Missing required file: $file" |
| 41 | + exit 1 |
| 42 | + else |
| 43 | + echo "✅ Found: $file" |
| 44 | + fi |
| 45 | + done |
| 46 | +
|
| 47 | + test-matrix: |
| 48 | + name: Test on ${{ matrix.os }} - Deno ${{ matrix.deno }} |
| 49 | + runs-on: ${{ matrix.os }} |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 53 | + deno: ['1.x', 'canary'] |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Setup Deno |
| 58 | + uses: denoland/setup-deno@v1 |
| 59 | + with: |
| 60 | + deno-version: ${{ matrix.deno }} |
| 61 | + |
| 62 | + - name: Cache Dependencies |
| 63 | + run: deno cache src/deps.ts |
| 64 | + |
| 65 | + - name: Run Tests |
| 66 | + run: deno test --allow-all |
| 67 | + |
| 68 | + security-audit: |
| 69 | + name: Security Audit |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: Setup Deno |
| 75 | + uses: denoland/setup-deno@v1 |
| 76 | + |
| 77 | + - name: Generate SBOM |
| 78 | + run: | |
| 79 | + deno info --json src/deps.ts > sbom.json |
| 80 | + cat sbom.json |
| 81 | +
|
| 82 | + - name: Secret Scanning |
| 83 | + uses: gitleaks/gitleaks-action@v2 |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + |
| 87 | + - name: Upload SBOM |
| 88 | + uses: actions/upload-artifact@v4 |
| 89 | + with: |
| 90 | + name: sbom |
| 91 | + path: sbom.json |
| 92 | + |
| 93 | + offline-first-test: |
| 94 | + name: Offline-First Verification |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - name: Setup Deno |
| 100 | + uses: denoland/setup-deno@v1 |
| 101 | + |
| 102 | + - name: Test Offline Mode |
| 103 | + run: | |
| 104 | + # Disable network |
| 105 | + sudo iptables -I INPUT -j DROP |
| 106 | + sudo iptables -I OUTPUT -j DROP |
| 107 | +
|
| 108 | + # Run offline tests |
| 109 | + deno test --allow-all tests/offline.test.ts || true |
| 110 | +
|
| 111 | + # Re-enable network |
| 112 | + sudo iptables -F |
| 113 | +
|
| 114 | + nix-build: |
| 115 | + name: Nix Reproducible Build |
| 116 | + runs-on: ubuntu-latest |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@v4 |
| 119 | + |
| 120 | + - name: Install Nix |
| 121 | + uses: cachix/install-nix-action@v24 |
| 122 | + with: |
| 123 | + nix_path: nixpkgs=channel:nixos-unstable |
| 124 | + |
| 125 | + - name: Build with Nix |
| 126 | + run: nix build |
| 127 | + |
| 128 | + - name: Run Nix Checks |
| 129 | + run: nix flake check |
| 130 | + |
| 131 | + documentation: |
| 132 | + name: Build Documentation |
| 133 | + runs-on: ubuntu-latest |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v4 |
| 136 | + |
| 137 | + - name: Setup Node |
| 138 | + uses: actions/setup-node@v4 |
| 139 | + with: |
| 140 | + node-version: '20' |
| 141 | + |
| 142 | + - name: Install TypeDoc |
| 143 | + run: npm install -g typedoc |
| 144 | + |
| 145 | + - name: Generate API Docs |
| 146 | + run: typedoc |
| 147 | + |
| 148 | + - name: Deploy to GitHub Pages |
| 149 | + if: github.ref == 'refs/heads/main' |
| 150 | + uses: peaceiris/actions-gh-pages@v3 |
| 151 | + with: |
| 152 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 153 | + publish_dir: ./docs/api |
| 154 | + |
| 155 | + benchmark: |
| 156 | + name: Performance Benchmarks |
| 157 | + runs-on: ubuntu-latest |
| 158 | + steps: |
| 159 | + - uses: actions/checkout@v4 |
| 160 | + |
| 161 | + - name: Setup Deno |
| 162 | + uses: denoland/setup-deno@v1 |
| 163 | + |
| 164 | + - name: Run Benchmarks |
| 165 | + run: deno bench --allow-all benches/ |
| 166 | + |
| 167 | + slsa-provenance: |
| 168 | + name: SLSA Provenance |
| 169 | + runs-on: ubuntu-latest |
| 170 | + permissions: |
| 171 | + id-token: write |
| 172 | + contents: read |
| 173 | + steps: |
| 174 | + - uses: actions/checkout@v4 |
| 175 | + |
| 176 | + - name: Setup Deno |
| 177 | + uses: denoland/setup-deno@v1 |
| 178 | + |
| 179 | + - name: Build |
| 180 | + run: deno run --allow-all build.ts |
| 181 | + |
| 182 | + - name: Generate Provenance |
| 183 | + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0 |
| 184 | + with: |
| 185 | + artifacts: dist/ |
| 186 | + |
| 187 | + container-scan: |
| 188 | + name: Container Security Scan |
| 189 | + runs-on: ubuntu-latest |
| 190 | + steps: |
| 191 | + - uses: actions/checkout@v4 |
| 192 | + |
| 193 | + - name: Build Docker Image |
| 194 | + run: docker build -t preference-injector:${{ github.sha }} . |
| 195 | + |
| 196 | + - name: Run Trivy Scanner |
| 197 | + uses: aquasecurity/trivy-action@master |
| 198 | + with: |
| 199 | + image-ref: preference-injector:${{ github.sha }} |
| 200 | + format: 'sarif' |
| 201 | + output: 'trivy-results.sarif' |
| 202 | + |
| 203 | + - name: Upload Trivy Results |
| 204 | + uses: github/codeql-action/upload-sarif@v3 |
| 205 | + with: |
| 206 | + sarif_file: 'trivy-results.sarif' |
0 commit comments