From fef710005f505fcdd2025ebb72edf81fc3b777ad Mon Sep 17 00:00:00 2001 From: Daniel Legt Date: Wed, 15 Apr 2026 19:55:01 +0300 Subject: [PATCH] docs(readme): document new code structure and CI publish Replace the outdated top-level file tree with a package-focused code structure section that reflects the current `lib/*` layout and responsibilities. Add a Gitea workflow section describing tagged Docker publish behavior, image tags, test step, and runner requirements so release automation is clear and repeatable.docs(readme): document new code structure and CI publish Replace the outdated top-level file tree with a package-focused code structure section that reflects the current `lib/*` layout and responsibilities. Add a Gitea workflow section describing tagged Docker publish behavior, image tags, test step, and runner requirements so release automation is clear and repeatable. --- .gitea/workflows/docker-publish.yml | 48 +++++++++++++++++++++++++++++ README.md | 34 +++++++++++--------- 2 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 .gitea/workflows/docker-publish.yml diff --git a/.gitea/workflows/docker-publish.yml b/.gitea/workflows/docker-publish.yml new file mode 100644 index 0000000..f26156c --- /dev/null +++ b/.gitea/workflows/docker-publish.yml @@ -0,0 +1,48 @@ +name: Build and Publish Docker Image +run-name: Publishing ${{ gitea.ref_name }} + +on: + push: + tags: + - "v*" + +env: + IMAGE_NAME: tea.chunkbyte.com/kato/cpu-benchmarker-server + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: false + + - name: Run Tests + run: go test ./... + + - name: Verify Docker Availability + run: docker version + + - name: Build Docker Image + run: | + docker build \ + -t $IMAGE_NAME:${{ gitea.ref_name }} \ + -t $IMAGE_NAME:latest \ + . + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: tea.chunkbyte.com + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Push Docker Image + run: | + docker push $IMAGE_NAME:${{ gitea.ref_name }} + docker push $IMAGE_NAME:latest diff --git a/README.md b/README.md index 46cb945..d36210f 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,6 @@ Production-oriented Go web application for ingesting CPU benchmark results, stor - A startup-loaded in-memory search index prevents full DB deserialization for every query. - Graceful shutdown closes the HTTP server and BadgerDB cleanly to avoid lock issues. -## Project Layout - -```text -. -├── main.go -├── handlers.go -├── db.go -├── models.go -├── templates/index.html -├── http/ -├── example_jsons/ -├── Dockerfile -└── docker-compose.yml -``` - ## Data Model Each stored submission contains: @@ -45,6 +30,16 @@ Each stored submission contains: The parser also accepts optional CPU metadata found in your local sample JSON files such as `isHybrid`, `has3DVCache`, `supportedFeatures`, and `cores`. +## Code Structure + +- `main.go` bootstraps configuration, storage, the HTTP server, and graceful shutdown. +- `lib/config` contains runtime configuration loading from environment variables. +- `lib/model` contains the benchmark and submission domain models plus validation helpers. +- `lib/store` contains BadgerDB persistence and the in-memory search index. +- `lib/web` contains routing, handlers, request parsing, pagination, and template helpers. +- `templates/index.html` contains the server-rendered frontend. +- `http/*.http` contains example requests for manual API testing. + ## Requirements - Go `1.23+` @@ -192,6 +187,15 @@ docker build -t cpu-benchmark-server . docker run --rm -p 8080:8080 -v cpu-benchmark-data:/data cpu-benchmark-server ``` +## Gitea Workflow + +The repository includes `.gitea/workflows/docker-publish.yml` for tagged Docker publishes. + +- Trigger: any pushed tag matching `v*` +- Test step: `go test ./...` +- Published images: `tea.chunkbyte.com/kato/cpu-benchmarker-server:` and `tea.chunkbyte.com/kato/cpu-benchmarker-server:latest` +- Runner requirement: the selected Gitea runner label must provide a working Docker CLI and daemon access for `docker build` and `docker push` + ## Notes - The UI uses Go templates plus Tailwind CSS via CDN.