Skip to content
Merged
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
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches: [main, master]
pull_request:

permissions:
contents: read

jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Build
run: go build ./...

- name: Vet
run: go vet ./...

- name: Test (race + coverage)
run: go test -race -coverpkg=./internal/... -coverprofile=coverage.out ./internal/...

- name: Coverage summary
run: go tool cover -func=coverage.out | tail -1

- name: Upload coverage profile
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.5.0
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
goreleaser:
name: GoReleaser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Build artifacts
/bin/
bodek

# Editor / OS noise
.DS_Store
*.swp
.idea/
.vscode/
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "2"

run:
timeout: 5m

linters:
default: standard # errcheck, govet, ineffassign, staticcheck, unused
exclusions:
rules:
# Test helpers freely ignore errors on HTTP test handlers and Close().
- path: _test\.go
linters:
- errcheck

formatters:
enable:
- gofmt
- goimports
51 changes: 51 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: 2

project_name: bodek

before:
hooks:
- go mod tidy

builds:
- id: bodek
main: ./cmd/bodek
binary: bodek
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w

archives:
- id: bodek
formats: [tar.gz]
name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
format_overrides:
- goos: windows
formats: [zip]

checksum:
name_template: checksums.txt

snapshot:
version_template: '{{ incpatch .Version }}-next'

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- '^chore:'

release:
draft: false
prerelease: auto
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 21no.de / BackendStack21

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
BINARY := bodek
PKG := ./cmd/bodek
GOBIN ?= $(shell go env GOPATH)/bin

.PHONY: all build install run fmt vet lint test cover tidy clean

all: build

## build: compile the bodek binary into ./bin
build:
@mkdir -p bin
go build -o bin/$(BINARY) $(PKG)

## install: install bodek into $GOBIN
install:
go install $(PKG)

## run: build and launch bodek (spawns `odek serve`)
run: build
./bin/$(BINARY)

## fmt: format all Go sources
fmt:
go fmt ./...

## vet: run go vet
vet:
go vet ./...

## lint: run golangci-lint if available
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
else \
echo "golangci-lint not installed; skipping (see https://golangci-lint.run)"; \
fi

## test: run the race-enabled test suite
test:
go test -race ./...

## cover: print internal-package coverage
cover:
go test -coverpkg=./internal/... -coverprofile=coverage.out ./internal/...
go tool cover -func=coverage.out | tail -1

## tidy: tidy module dependencies
tidy:
go mod tidy

## clean: remove build artifacts
clean:
rm -rf bin
Loading
Loading