docs(readme): document new code structure and CI publish
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 40s
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 40s
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.
This commit is contained in:
48
.gitea/workflows/docker-publish.yml
Normal file
48
.gitea/workflows/docker-publish.yml
Normal file
@@ -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
|
||||||
34
README.md
34
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.
|
- 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.
|
- 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
|
## Data Model
|
||||||
|
|
||||||
Each stored submission contains:
|
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`.
|
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
|
## Requirements
|
||||||
|
|
||||||
- Go `1.23+`
|
- 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
|
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:<tag>` 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
|
## Notes
|
||||||
|
|
||||||
- The UI uses Go templates plus Tailwind CSS via CDN.
|
- The UI uses Go templates plus Tailwind CSS via CDN.
|
||||||
|
|||||||
Reference in New Issue
Block a user