Skip to content

refactor: rename dream mode "silent" to "throttled" #48

refactor: rename dream mode "silent" to "throttled"

refactor: rename dream mode "silent" to "throttled" #48

Workflow file for this run

# ctx CI/CD Pipeline
# github.com/GottZ/ctx — The memory your LLM pretends to have.
# GottZ 4-Way RRF | GottZ Scope Model | GottZ Guard
#
# Branch-Strategie: root (Haupt-Branch), keine main/master-Konvention.
# Alle Stages laufen auf: push to root, PR to root, workflow_dispatch.
name: ctx CI/CD
on:
push:
branches: [root]
pull_request:
branches: [root]
workflow_dispatch:
# Deny-all default — jeder Job deklariert eigene Permissions.
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }}
env:
GO_VERSION: "1.25"
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/gottz/ctx
jobs:
# ─── Stage 1: Lint ────────────────────────────────────────────────────────────
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
working-directory: go
args: --timeout=5m
only-new-issues: ${{ github.event_name == 'pull_request' }}
# ─── Stage 2: Unit Tests ──────────────────────────────────────────────────────
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go/go.sum
- name: Run unit tests
working-directory: go
run: |
go test \
-v \
-short \
-race \
-count=1 \
-timeout=5m \
-coverprofile=coverage.out \
-covermode=atomic \
./...
- name: Upload coverage
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: coverage-unit
path: go/coverage.out
retention-days: 7
# ─── Stage 3: Integration Tests ───────────────────────────────────────────────
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [unit-tests]
permissions:
contents: read
env:
TESTCONTAINERS_RYUK_DISABLED: "false"
TESTCONTAINERS_PULL_POLICY: "default"
CONTEXT_DB: context_store
CONTEXT_DB_USER: context_user
CONTEXT_DB_PASSWORD: testpassword
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go/go.sum
- name: Cache testcontainers Docker images
uses: ScribeMD/docker-cache@fb28c93772363301b8d0a6072ce850224b73f74e # 0.5.0
with:
key: docker-testcontainers-pgvector-pg17-${{ runner.os }}
- name: Run integration tests
working-directory: go
run: |
go test \
-v \
-tags=integration \
-count=1 \
-timeout=10m \
-coverprofile=coverage-integration.out \
-covermode=atomic \
./...
- name: Upload integration coverage
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: coverage-integration
path: go/coverage-integration.out
retention-days: 7
# ─── Stage 4: Build Binary ────────────────────────────────────────────────────
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [lint, unit-tests]
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go/go.sum
- name: Build binary
working-directory: go
env:
CGO_ENABLED: "0"
GOOS: linux
GOARCH: amd64
run: |
go build \
-trimpath \
-ldflags="-s -w \
-X main.Version=${{ github.ref_name }} \
-X main.Commit=${{ github.sha }} \
-X main.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o ../ctxd \
./cmd/ctxd/
- name: Verify binary
run: |
file ctxd
./ctxd --version 2>/dev/null || ./ctxd version 2>/dev/null || true
- name: Upload binary artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ctxd-linux-amd64
path: ctxd
retention-days: 1
# ─── Stage 5: Docker Build + Push ─────────────────────────────────────────────
docker:
name: Docker Build + Push
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [build, integration-tests]
if: >-
github.ref == 'refs/heads/root' ||
github.event_name == 'workflow_dispatch'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download binary artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ctxd-linux-amd64
- name: Make binary executable
run: chmod +x ctxd
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to GitHub Container Registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/root' }}
type=sha,prefix=sha-,format=short
type=raw,value={{date 'YYYY-MM-DD'}}
labels: |
org.opencontainers.image.title=ctx
org.opencontainers.image.description=The memory your LLM pretends to have. GottZ 4-Way RRF + GottZ Scope Model.
org.opencontainers.image.url=https://github.com/GottZ/ctx
org.opencontainers.image.source=https://github.com/GottZ/ctx
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=MPL-2.0
- name: Build and push Docker image
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: ./go
file: ./go/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
type=gha
cache-to: |
type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
type=gha,mode=max