Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Go workspace file
go.work
go.work.sum

# Test files
*.nevrcap
*.echoreplay
/benchmark_*
/test_*
/output
83 changes: 83 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Run and Update Benchmarks

on:
release:
types:
- created

jobs:
bench:
if: github.event.release.draft == true
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'

- name: Run benchmarks
id: run_bench
run: |
mkdir -p bench-output
go test -bench=. -benchmem ./... > bench-output/bench.txt || true
cat bench-output/bench.txt

- name: Save benchmark artifact
uses: actions/upload-artifact@v4
with:
name: bench-output
path: bench-output/bench.txt

- name: Get previous tag
id: prev_tag
run: |
# find most recent tag before this release tag (if Git history has tags)
git fetch --tags
echo "RELEASE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
prev=$(git tag --sort=-creatordate | grep -v "${{ github.event.release.tag_name }}" | sed -n '1p' || true)
echo "PREV_TAG=${prev}" >> $GITHUB_ENV
echo "Found previous tag: ${prev}"

- name: Download previous benchmarks (if available)
if: env.PREV_TAG != ''
run: |
echo "No automatic previous benchmark retrieval implemented; proceeding without baseline."

- name: Compare and update BENCHMARKS.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
mkdir -p tools
cat > tools/update_benchmarks.sh <<'SH'
#!/usr/bin/env bash
set -euo pipefail
out=bench-output/bench.txt
md=BENCHMARKS.md

timestamp=$(date -u +"%Y-%m-%d %H:%M:%SZ")
echo "## Benchmark results for ${RELEASE_TAG} - ${timestamp}\n" > /tmp/bench_update.md
echo '```' >> /tmp/bench_update.md
sed -n '1,200p' "$out" >> /tmp/bench_update.md
echo '```' >> /tmp/bench_update.md

if [ -f "$md" ]; then
cat $md >> /tmp/bench_update.md
fi

mv /tmp/bench_update.md $md

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add $md
git commit -m "Update BENCHMARKS.md: add results for ${RELEASE_TAG}" || echo "No changes to commit"
git push origin HEAD:${{ github.head_ref || github.ref }}
SH
chmod +x tools/update_benchmarks.sh
./tools/update_benchmarks.sh

68 changes: 68 additions & 0 deletions .github/workflows/build-release-binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build Release Binaries

on:
release:
types: [created]

jobs:
build-and-upload:
if: github.event.release.draft == true && github.event.release.tag_name != ''
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows]
goarch: [amd64, arm64]
exclude:
# Exclude Windows ARM64 for now (uncomment if needed)
- goos: windows
goarch: arm64

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'

- name: Get version
id: version
run: |
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo v0.0.0)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"

- name: Build binaries
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
LDFLAGS="-X main.version=${VERSION} -s -w"

# Extension for Windows
EXT=""
if [ "$GOOS" == "windows" ]; then
EXT=".exe"
fi

# Build each command
for cmd in agent apiserver converter dumpevents replayer webviewer; do
OUTPUT_NAME="${cmd}_${VERSION}_${GOOS}_${GOARCH}${EXT}"
echo "Building $OUTPUT_NAME"
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "$LDFLAGS" -o "$OUTPUT_NAME" ./cmd/$cmd
done

- name: List built files
run: ls -lah *_${{ steps.version.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}*

- name: Upload binaries to release
uses: softprops/action-gh-release@v1
with:
files: |
*_${{ steps.version.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Attach Release Artifacts

on:
release:
types:
- created

jobs:
build:
if: github.event.release.draft == true && github.event.release.tag_name != ''
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
- name: Build binary
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
GOOS=windows GOARCH=amd64 go build -o evr-data-recorder.exe main.go
else
GOOS=linux GOARCH=amd64 go build -o evr-data-recorder main.go
fi
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-binary
path: |
evr-data-recorder*

attach:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List files
run: ls -l ./artifacts
- name: Upload release assets
uses: softprops/action-gh-release@v1
with:
files: |
./artifacts/**/evr-data-recorder*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#

# vscode
.vscode/

# Binaries for programs and plugins
*.exe
*.exe~
Expand All @@ -23,3 +27,13 @@ go.work.sum

# env file
.env

# binary
/agent
/replayer
/converter
/apiserver
/dumpevents
/webviewer
output/
/virtex-exporter
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo v0.0.0)
LDFLAGS = -X main.version=$(VERSION) -s -w

BINARY = datarecorder
BIN_DIR = .

.PHONY: all build build-linux build-windows test bench clean version replay-server virtex-exporter

all: build

version:
@echo $(VERSION)

build: | $(BIN_DIR)
@echo "Building $(BINARY) (version=$(VERSION))"
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(BINARY) .

replay-server: | $(BIN_DIR)
@echo "Building replay-server (version=$(VERSION))"
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/replay-server ./cmd/replayer

virtex-exporter: | $(BIN_DIR)
@echo "Building virtex-exporter (version=$(VERSION))"
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/virtex-exporter ./cmd/virtex-exporter

build-linux: | $(BIN_DIR)
@echo "Building linux/amd64 $(BINARY) (version=$(VERSION))"
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(BINARY)-linux .

build-windows: | $(BIN_DIR)
@echo "Building windows/amd64 $(BINARY) (version=$(VERSION))"
GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/$(BINARY).exe .

bench:
go test -bench=. -benchmem ./...

test:
go test ./...

$(BIN_DIR):
mkdir -p $(BIN_DIR)

clean:
rm -rf $(BIN_DIR)
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# evr-data-recorder
session and player bone data recorder
session and player bone data recorder for EchoVR game engine.

A small command-line tool that records session and player
bone data from the HTTP API of the EchoVR game engine.

Prerequisites (to build)
- Go 1.25

Build
- Build for the current OS:

```bash
go build -o datarecorder ./
```

- Cross-compile for Linux (amd64):

```bash
GOOS=linux GOARCH=amd64 go build -o datarecorder ./
```

- Cross-compile for Windows (amd64):

```bash
GOOS=windows GOARCH=amd64 go build -o datarecorder.exe ./
```

Run
- Run the built binary (example):

The following will regularly scan ports 6721 through 6730, and start polling
at upto 30 times a second, the HTTP API, storing to output to

```bash
./datarecorder.exe -debug -frequency 30 -log agent.log -output ./output 127.0.0.1:6721-6730
```

Tests
- Run unit tests:

```bash
go test ./...
```

Loading
Loading