|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths-ignore: |
| 7 | + - "**.md" |
| 8 | + pull_request: |
| 9 | + paths-ignore: |
| 10 | + - "**.md" |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ci-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +# Minimal permissions by default |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +jobs: |
| 22 | + go-build-and-test: |
| 23 | + name: Go Build & Test |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + contents: read |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + service: [registry, tool-firewall, airlock] |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - uses: actions/setup-go@v5 |
| 33 | + with: |
| 34 | + go-version: "1.23" |
| 35 | + cache-dependency-path: services/${{ matrix.service }}/go.sum |
| 36 | + |
| 37 | + - name: Build |
| 38 | + working-directory: services/${{ matrix.service }} |
| 39 | + run: CGO_ENABLED=0 go build -ldflags="-s -w" -o /dev/null . |
| 40 | + |
| 41 | + - name: Test |
| 42 | + working-directory: services/${{ matrix.service }} |
| 43 | + run: go test -v -race -count=1 ./... |
| 44 | + |
| 45 | + - name: Vet |
| 46 | + working-directory: services/${{ matrix.service }} |
| 47 | + run: go vet ./... |
| 48 | + |
| 49 | + go-securectl: |
| 50 | + name: Build securectl CLI |
| 51 | + runs-on: ubuntu-latest |
| 52 | + permissions: |
| 53 | + contents: read |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - uses: actions/setup-go@v5 |
| 57 | + with: |
| 58 | + go-version: "1.23" |
| 59 | + cache-dependency-path: services/registry/go.sum |
| 60 | + |
| 61 | + - name: Build securectl |
| 62 | + working-directory: services/registry |
| 63 | + run: CGO_ENABLED=0 go build -ldflags="-s -w" -o /dev/null ./cmd/securectl/ |
| 64 | + |
| 65 | + python-test: |
| 66 | + name: Python Test & Lint |
| 67 | + runs-on: ubuntu-latest |
| 68 | + permissions: |
| 69 | + contents: read |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v4 |
| 72 | + - uses: actions/setup-python@v5 |
| 73 | + with: |
| 74 | + python-version: "3.12" |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: pip install pyyaml flask requests pytest |
| 78 | + |
| 79 | + - name: Lint (syntax check) |
| 80 | + run: | |
| 81 | + python -m py_compile services/quarantine/quarantine/pipeline.py |
| 82 | + python -m py_compile services/quarantine/quarantine/watcher.py |
| 83 | + python -m py_compile services/ui/ui/app.py |
| 84 | +
|
| 85 | + - name: Test quarantine pipeline |
| 86 | + run: python -m pytest tests/test_pipeline.py -v |
| 87 | + |
| 88 | + - name: Test UI app |
| 89 | + run: python -m pytest tests/test_ui.py -v |
| 90 | + |
| 91 | + shellcheck: |
| 92 | + name: Shell Script Lint |
| 93 | + runs-on: ubuntu-latest |
| 94 | + permissions: |
| 95 | + contents: read |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - name: Lint shell scripts |
| 100 | + run: | |
| 101 | + shellcheck -s bash \ |
| 102 | + files/system/usr/libexec/secure-ai/firstboot.sh \ |
| 103 | + files/system/usr/libexec/secure-ai/panic.sh \ |
| 104 | + files/system/usr/libexec/secure-ai/setup-vault.sh \ |
| 105 | + files/system/usr/libexec/secure-ai/select-model.sh \ |
| 106 | + files/scripts/build-services.sh |
| 107 | +
|
| 108 | + policy-validate: |
| 109 | + name: Validate YAML configs |
| 110 | + runs-on: ubuntu-latest |
| 111 | + permissions: |
| 112 | + contents: read |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v4 |
| 115 | + - uses: actions/setup-python@v5 |
| 116 | + with: |
| 117 | + python-version: "3.12" |
| 118 | + |
| 119 | + - name: Install pyyaml |
| 120 | + run: pip install pyyaml |
| 121 | + |
| 122 | + - name: Validate YAML files |
| 123 | + run: | |
| 124 | + python -c " |
| 125 | + import yaml, sys, glob |
| 126 | + errors = 0 |
| 127 | + for pattern in ['files/system/etc/secure-ai/**/*.yaml', 'recipes/*.yml']: |
| 128 | + for f in glob.glob(pattern, recursive=True): |
| 129 | + try: |
| 130 | + with open(f) as fh: |
| 131 | + yaml.safe_load(fh) |
| 132 | + print(f'OK: {f}') |
| 133 | + except Exception as e: |
| 134 | + print(f'FAIL: {f}: {e}') |
| 135 | + errors += 1 |
| 136 | + sys.exit(errors) |
| 137 | + " |
0 commit comments